def print_help(self, with_description=True): """Print description, usage and a detailed help message. @type with_description: bool @param with_description: if true, print module's __doc__ string """ if with_description: print() print(__doc__.strip()) print() if self.warning: print() for line in self.warning: sys.stderr.write(pp.warn(line)) print() print(mod_usage(mod_name=self.module_name, arg=self.arg_spec, optional=self.arg_option)) print() print(pp.command("options")) print(format_options( self.formatted_options )) if self.formatted_args: print() print(pp.command(self.arg_spec)) print(format_options(self.formatted_args)) print()
def print_help(module_info, formatted_options=None, with_description=True): """Print description, usage and a detailed help message. @param with_description (bool): Option to print module's __doc__ or not """ if with_description: print() print(module_info["__doc__"]) print() print(main_usage(module_info)) print() print(pp.globaloption("global options")) print(format_options(GLOBAL_OPTIONS)) print() if formatted_options: print(pp.command("modules") + " (" + pp.command("short name") + ")") print(format_options(formatted_options)) else: print("Error: calling function did not supply formatted options") print()