ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran-z <>
Subject [GitHub] incubator-ariatosca pull request #107: ARIA-148 CLI display commands
Date Thu, 11 May 2017 08:47:58 GMT
Github user ran-z commented on a diff in the pull request:
    --- Diff: aria/cli/core/ ---
    @@ -65,15 +58,33 @@ def __init__(self, *args, **kwargs):
             super(MutuallyExclusiveOption, self).__init__(*args, **kwargs)
         def handle_parse_result(self, ctx, opts, args):
    -        if self.mutually_exclusive.intersection(opts) and in opts:
    +        if ( in opts) and self.mutually_exclusive.keys().intersection(opts):
                 raise click.UsageError(
                     'Illegal usage: `{0}` is mutually exclusive with '
                     'arguments: [{1}] ({2}).'.format(
    -        return super(MutuallyExclusiveOption, self).handle_parse_result(
    -            ctx, opts, args)
    +        return super(MutuallyExclusiveOption, self).handle_parse_result(ctx, opts, args)
    +def mutually_exclusive_option(*param_decls, **attrs):
    +    """
    +    Makes options mutually exclusive. The decorator must pass a a ``mutually_exclusive``
    +    with a list of argument names with which the option is mutually exclusive.
    +    NOTE: All mutually exclusive options must use this. It's not enough to use it in
just one of the
    +    options.
    +    """
    +    def decorator(func):
    +        if 'help' in attrs:
    --- End diff --
    could you please document this func a bit more?
    I'm not sure what are `param_decls` and `attrs` in this case, why `help` is being inspected,
and why the internal `__click_params__` is accessed directly here.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message