def main(): try: cli_interface = _setup_command_line_interface() cli_args = cli_interface.parse_args(sys.argv[1:]) _setup_logging(cli_args) if cli_args.command_name is None: raise FatalError("Missing command. Use 'edi --help' for help.") command_name = "{0}.{1}".format(EdiCommand._get_command_name(), cli_args.command_name) get_command(command_name)().run_cli(cli_args) except FatalError as fatal_error: print_error_and_exit(fatal_error.message) except KeyboardInterrupt: print_error_and_exit("Command interrupted by user.") except CalledProcessError as subprocess_error: print_error_and_exit( "{}\nFor more information increase the log level.".format( subprocess_error)) except requests.exceptions.SSLError as ssl_error: print_error_and_exit( "{}\nPlease verify your ssl/proxy setup.".format(ssl_error)) except requests.exceptions.ConnectionError as connection_error: print_error_and_exit(( "{}\nPlease verify your internet connectivity and the requested url." ).format(connection_error))
def main(): try: cli_interface = _setup_command_line_interface() cli_args = cli_interface.parse_args(sys.argv[1:]) _setup_logging(cli_args) if cli_args.command_name is None: raise FatalError("Missing subcommand. Use 'edi --help' for help.") command_name = "{0}.{1}".format(EdiCommand._get_command_name(), cli_args.command_name) get_command(command_name)().run_cli(cli_args) except FatalError as fatal_error: print_error_and_exit(fatal_error.message) except KeyboardInterrupt: print_error_and_exit("Command interrupted by user.") except CalledProcessError as subprocess_error: print_error_and_exit( "{}\nFor more information increase the log level.".format( subprocess_error))
def _get_sub_command(self, command): sub_command = "{}.{}".format(self._get_command_name(), command) return get_command(sub_command)