Refactored frontend module and removed duplicate code

Frontend module repeats  functions for distutils and cli interface, I tried to merge this parts of code.
This condition is ambiguous, could you change it with (not self.input_file and not self.directory) or (not self.output_file and not self.directory) ?