def execute_command(parser, config, ext_classes): """ Banana banana """ res = 0 cmd = config.get('command') get_private_folder = config.get('get_private_folder', False) if cmd == 'help': parser.print_help() elif cmd == 'run' or get_private_folder: # git.mk backward compat app = Application(ext_classes) try: app.parse_config(config) if get_private_folder: print(app.private_folder) return res res = app.run() except HotdocException: res = len(Logger.get_issues()) except Exception: # pylint: disable=broad-except print("An unknown error happened while building the documentation" " and hotdoc cannot recover from it. Please report " "a bug with this error message and the steps to " "reproduce it") traceback.print_exc() res = 1 finally: app.finalize() elif cmd == 'init': try: create_default_layout(config) except HotdocException: res = 1 elif cmd == 'conf': config.dump(conf_file=config.get('output_conf_file', None)) elif cmd is None: if config.get('version'): print(VERSION) elif config.get('makefile_path'): here = os.path.dirname(__file__) path = os.path.join(here, 'utils', 'hotdoc.mk') print(os.path.abspath(path)) elif config.get('get_conf_path'): key = config.get('get_conf_path') path = config.get_path(key, rel_to_cwd=True) if path is not None: print(path) elif config.get('get_conf_key'): key = config.get('get_conf_key') value = config.get(key, None) if value is not None: print(value) else: parser.print_usage() else: parser.print_usage() return res
def run(args): """ Banana banana """ res = 0 doc_repo = DocRepo() # pylint: disable=broad-except try: doc_repo.load_command_line(args) doc_repo.setup() doc_repo.format() doc_repo.persist() except HotdocException: res = len(Logger.get_issues()) except Exception: print("An unknown error happened while building the documentation" " and hotdoc cannot recover from it. Please report " "a bug with this error message and the steps to " "reproduce it") traceback.print_exc() res = 1 finally: doc_repo.finalize() return res
def run(args): """ Banana banana """ res = 0 doc_repo = DocRepo() # pylint: disable=broad-except try: doc_repo.load_command_line(args) doc_repo.setup() doc_repo.format() doc_repo.persist() except HotdocException: res = len(Logger.get_issues()) except Exception: print ("An unknown error happened while building the documentation" " and hotdoc cannot recover from it. Please report " "a bug with this error message and the steps to " "reproduce it") traceback.print_exc() res = 1 finally: doc_repo.finalize() return res