This commit includes the following changes: 1. Move all the functionality for listing supported command and displaying their summary to the 'help' subcommand. 2. Simplified the root cli so that it doesn't need to execute all of the subcommand to gather their summary. This is only done on demand now. 3. Changed tox so that flake8 is run using the verbose flag.
27 lines
649 B
Python
27 lines
649 B
Python
def make_command_summary_string(command_summaries):
|
|
"""Construct subcommand summaries
|
|
|
|
:param command_summaries: Commands and their summaries
|
|
:type command_summaries: list of (str, str)
|
|
:returns: The subcommand summaries
|
|
:rtype: str
|
|
"""
|
|
|
|
doc = ''
|
|
for command, summary in command_summaries:
|
|
doc += '\n\t{:15}\t{}'.format(command, summary.strip())
|
|
|
|
return doc
|
|
|
|
|
|
def make_generic_usage_message(doc):
|
|
"""Construct generic usage error
|
|
|
|
:param doc: Usage documentation for program
|
|
:type doc: str
|
|
:returns: Generic usage error
|
|
:rtype: str
|
|
"""
|
|
|
|
return 'Unknown option\n{}'.format(doc)
|