Commit 64f0cf82 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[click_helper] Add minimal documentation

parent 670861fc
......@@ -32,6 +32,7 @@
# #
###################################################################################
"""Click based helper classes"""
import click
......@@ -40,6 +41,8 @@ class AliasedGroup(click.Group):
""" Class that handles prefix aliasing for commands """
def get_command(self, ctx, cmd_name):
"""Re-imp"""
rv = click.Group.get_command(self, ctx, cmd_name)
if rv is not None:
return rv
......@@ -58,6 +61,8 @@ class MutuallyExclusiveOption(click.Option):
"""
def __init__(self, *args, **kwargs):
"""Initialize"""
self.mutually_exclusive = set(kwargs.pop("mutually_exclusive", []))
help_ = kwargs.get("help", "")
if self.mutually_exclusive:
......@@ -72,6 +77,8 @@ class MutuallyExclusiveOption(click.Option):
super().__init__(*args, **kwargs)
def handle_parse_result(self, ctx, opts, args):
"""Re-imp"""
if self.mutually_exclusive.intersection(opts) and self.name in opts:
raise click.UsageError(
"Illegal usage: `{}` is mutually exclusive with "
......@@ -108,5 +115,7 @@ class AssetCommand(click.Command):
asset_info = AssetInfo()
def invoke(self, ctx):
"""Re-imp"""
ctx.meta["asset_info"] = self.asset_info
return super().invoke(ctx)
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