[
https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16006109#comment-16006109
]
ASF GitHub Bot commented on ARIA-148:
-------------------------------------
Github user ran-z commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115935686
--- Diff: aria/cli/core/aria.py ---
@@ -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 self.name in
opts:
+ if (self.name in opts) and
self.mutually_exclusive.keys().intersection(opts):
raise click.UsageError(
'Illegal usage: `{0}` is mutually exclusive with '
'arguments: [{1}] ({2}).'.format(
self.name,
self.mutuality_string,
self.mutuality_error_message))
- 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`` argument
+ 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.
> Enhance CLI "show" commands
> ---------------------------
>
> Key: ARIA-148
> URL: https://issues.apache.org/jira/browse/ARIA-148
> Project: AriaTosca
> Issue Type: Story
> Reporter: Tal Liron
> Assignee: Tal Liron
>
> For {{aria service-templates show}} and {{aria services show}} add support
> for dumping, including graphs and type hierarchies, in JSON and YAML.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)