|
@@ -127,22 +127,25 @@ def change_password(password=None, retype_password=None):
|
|
# noinspection PyShadowingBuiltins
|
|
# noinspection PyShadowingBuiltins
|
|
def help():
|
|
def help():
|
|
print('Allowed commands:')
|
|
print('Allowed commands:')
|
|
|
|
+ command_table = []
|
|
for cmd in allowed_commands:
|
|
for cmd in allowed_commands:
|
|
this_module = sys.modules[__name__]
|
|
this_module = sys.modules[__name__]
|
|
method = getattr(this_module, cmd)
|
|
method = getattr(this_module, cmd)
|
|
params = signature(method).parameters
|
|
params = signature(method).parameters
|
|
num_args = len(params)
|
|
num_args = len(params)
|
|
- if num_args > 0:
|
|
|
|
- print('`' + cmd + '`', 'takes the following', num_args, 'arguments:')
|
|
|
|
- for p in params:
|
|
|
|
- print(' -', p)
|
|
|
|
- else:
|
|
|
|
- print('`' + cmd + '`', 'takes no arguments')
|
|
|
|
- print()
|
|
|
|
-
|
|
|
|
|
|
+ command_table.append([cmd] + [p for p in params])
|
|
|
|
+
|
|
|
|
+ print(_my_tabulate(command_table,tablefmt='pipe',headers=['command',
|
|
|
|
+ 'parameter 1',
|
|
|
|
+ 'parameter 2',
|
|
|
|
+ 'parameter 3',
|
|
|
|
+ 'parameter 4',
|
|
|
|
+ 'parameter 5',
|
|
|
|
+ ]))
|
|
print('NOTE:')
|
|
print('NOTE:')
|
|
|
|
+ print(' All parameters for all commands are optional!')
|
|
print(' Commands can be combined in one line with ; between them.')
|
|
print(' Commands can be combined in one line with ; between them.')
|
|
- print(' All arguments for all commands are optional!')
|
|
|
|
|
|
+ print(' Parameters are separated with any whitespace.')
|
|
|
|
|
|
|
|
|
|
def _my_tabulate(data, **params):
|
|
def _my_tabulate(data, **params):
|