Updated help.py
Added implementation to run command. For every argument give (a command), the help message for that command is displayed. Renamed `__cmd_name__` to `name`, which will be standard across all commands.
This commit is contained in:
parent
d7a2aa489b
commit
7500d5424f
|
|
@ -6,9 +6,11 @@ class Help(command.Command, metaclass=command.RegisterCommand):
|
|||
__doc__ = """Display the help message of the give command(s), or print this message.
|
||||
|
||||
Usage: help [<command1>, <command2>, ..., <commandn>]
|
||||
|
||||
If no arguments are specified, the general help message is displayed.
|
||||
"""
|
||||
|
||||
__cmd_name__ = "help"
|
||||
name = "help"
|
||||
|
||||
def __init__(self, *, data: argparse.Namespace, args: list[str] = []) -> None:
|
||||
super().__init__()
|
||||
|
|
@ -17,8 +19,13 @@ Usage: help [<command1>, <command2>, ..., <commandn>]
|
|||
|
||||
|
||||
def run(self):
|
||||
print("running command: %s" % __name__)
|
||||
print(self.data, self.rargs)
|
||||
|
||||
if not self.rargs:
|
||||
self.parser.print_help()
|
||||
|
||||
for arg in self.rargs:
|
||||
obj = self.get_command(arg, error=True)
|
||||
if obj is None:
|
||||
pass
|
||||
|
||||
print("%s: %s" % (obj.__class__.name, obj.__doc__))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user