Skip to content
Snippets Groups Projects
Commit 13a70cfc authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Merge branch 'bool' into 'master'

Improve the bool option

See merge request !85
parents abd22b43 bb305aba
No related branches found
No related tags found
1 merge request!85Improve the bool option
Pipeline #
...@@ -37,9 +37,9 @@ def bool_option(name, short_name, desc, dflt=False, **kwargs): ...@@ -37,9 +37,9 @@ def bool_option(name, short_name, desc, dflt=False, **kwargs):
ctx.meta[name.replace('-', '_')] = value ctx.meta[name.replace('-', '_')] = value
return value return value
return click.option( return click.option(
'-' + short_name, '--%s/--no-%s' % (name, name), default=dflt, '-%s/-n%s' % (short_name, short_name), '--%s/--no-%s' % (name, name),
help=desc, default=dflt, help=desc, show_default=True, callback=callback,
show_default=True, callback=callback, is_eager=True, **kwargs)(func) is_eager=True, **kwargs)(func)
return custom_bool_option return custom_bool_option
...@@ -262,6 +262,7 @@ class ResourceOption(click.Option): ...@@ -262,6 +262,7 @@ class ResourceOption(click.Option):
return value return value
class AliasedGroup(click.Group): class AliasedGroup(click.Group):
''' Class that handles prefix aliasing for commands ''' Class that handles prefix aliasing for commands
...@@ -273,6 +274,7 @@ class AliasedGroup(click.Group): ...@@ -273,6 +274,7 @@ class AliasedGroup(click.Group):
To enable prefix aliasing of commands for a given group, To enable prefix aliasing of commands for a given group,
just set ``cls=AliasedGroup`` parameter in click.group decorator. just set ``cls=AliasedGroup`` parameter in click.group decorator.
''' '''
def get_command(self, ctx, cmd_name): def get_command(self, ctx, cmd_name):
rv = click.Group.get_command(self, ctx, cmd_name) rv = click.Group.get_command(self, ctx, cmd_name)
if rv is not None: if rv is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment