diff options
author | Jan Cholasta <jcholast@redhat.com> | 2016-06-16 10:19:25 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2016-06-20 16:39:12 +0200 |
commit | d0cfe37a7ebda848abd32fc46129e7844da5a9be (patch) | |
tree | e32311a7479428c2ea83d6f27942a944ec6337f2 /ipaserver/plugins | |
parent | 91faf3ecd7708409350c8c5961833cbde202b2b2 (diff) | |
download | freeipa-d0cfe37a7ebda848abd32fc46129e7844da5a9be.tar.gz freeipa-d0cfe37a7ebda848abd32fc46129e7844da5a9be.tar.xz freeipa-d0cfe37a7ebda848abd32fc46129e7844da5a9be.zip |
schema: merge command args and options
Rather than having args and options separately in command schema, merge
them together and use new `positional` param flag to differentiate between
them.
https://fedorahosted.org/freeipa/ticket/4739
Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'ipaserver/plugins')
-rw-r--r-- | ipaserver/plugins/schema.py | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/ipaserver/plugins/schema.py b/ipaserver/plugins/schema.py index 32803a053..42806e775 100644 --- a/ipaserver/plugins/schema.py +++ b/ipaserver/plugins/schema.py @@ -176,16 +176,6 @@ class command(metaobject): label=_("Method name"), flags={'no_search'}, ), - Str( - 'args_param*', - label=_("Arguments"), - flags={'no_search'}, - ), - Str( - 'options_param*', - label=_("Options"), - flags={'no_search'}, - ), Bool( 'no_cli?', label=_("Exclude from CLI"), @@ -222,13 +212,6 @@ class command(metaobject): if cmd.NO_CLI: obj['no_cli'] = True - if len(cmd.args): - obj['args_param'] = tuple(unicode(n) for n in cmd.args) - - if len(cmd.options): - obj['options_param'] = tuple( - unicode(n) for n in cmd.options if n != 'version') - return obj def _retrieve(self, name, **kwargs): @@ -560,6 +543,11 @@ class param(BaseParam): label=_("Sensitive"), flags={'no_search'}, ), + Bool( + 'positional?', + label=_("Positional argument"), + flags={'no_search'}, + ), ) @property @@ -585,6 +573,11 @@ class param(BaseParam): obj['multivalue'] = True if param.password: obj['sensitive'] = True + if isinstance(metaobj, Command): + if param.required and param.name not in metaobj.args: + obj['positional'] = False + elif not param.required and param.name in metaobj.args: + obj['positional'] = True for key, value in param._Param__clonekw.items(): if key in ('doc', |