Commit 1aa9b162 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[commands] Add initializer helper method

parent 465aeff0
......@@ -247,4 +247,28 @@ CMD_TABLE = {
def command(name):
"""Returns a copy of the method to be decorated.
This allows to reuse the same commands. Using directly the original method
would allow to only use it once.
Parameters:
name str: Name of the desired command
"""
return copy_func(CMD_TABLE[name])
def initialise_asset_commands(click_cmd_group, cmd_list):
"""Initialize a command group adding all the commands from cmd_list to it
Parameters:
click_cmd_group obj: click command to group
cmd_list list: list of string or tuple of the commands to add
"""
for item in cmd_list:
if isinstance(item, tuple):
click_cmd_group.command(name=item[0])(command(item[1]))
else:
click_cmd_group.command(name=item)(command(item))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment