Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.cmdline
Commits
1aa9b162
Commit
1aa9b162
authored
May 03, 2019
by
Samuel GAIST
Browse files
[commands] Add initializer helper method
parent
465aeff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/commands.py
View file @
1aa9b162
...
...
@@ -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
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment