Show more command data

This commit is contained in:
Andre Basche 2023-03-06 19:45:46 +01:00
parent 79a121263f
commit 43d61ab853
6 changed files with 22 additions and 12 deletions

View file

@ -24,7 +24,7 @@ def get_arguments():
return vars(parser.parse_args())
# yaml.dump() would be done the same, but needs an additional import...
# yaml.dump() would be done the same, but needs an additional dependency...
def pretty_print(data, key="", intend=0, is_list=False):
if type(data) is list:
if key:
@ -47,6 +47,18 @@ def pretty_print(data, key="", intend=0, is_list=False):
print(f"{' ' * intend}{'- ' if is_list else ''}{key}{': ' if key else ''}{data}")
def create_command(commands):
result = {}
for name, command in commands.items():
result[name] = {}
for parameter, data in command.parameters.items():
if data.typology == "enum":
result[name][parameter] = data.values
if data.typology == "range":
result[name][parameter] = {"min": data.min, "max": data.max, "step": data.step}
return result
async def main():
args = get_arguments()
if not (user := args["user"]):