Hello Ravi Nori,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/21142
to review the following change.
Change subject: cli: x-identifier auto-completion doesn't work in
permissions(#1027281)
......................................................................
cli: x-identifier auto-completion doesn't work in permissions(#1027281)
append of -identifier suffix for vm object at
permission auto-completion doesn't work for
list/show/remove commands.
Change-Id: Id9b1578dada8a3810bec766951e346c59abad61f
Bug-Url: https://bugzilla.redhat.com/1027281
Signed-off-by: Ravi Nori <[email protected]>
---
M src/ovirtcli/utils/autocompletionhelper.py
1 file changed, 24 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/42/21142/1
diff --git a/src/ovirtcli/utils/autocompletionhelper.py
b/src/ovirtcli/utils/autocompletionhelper.py
index 4b2394d..37146fe 100644
--- a/src/ovirtcli/utils/autocompletionhelper.py
+++ b/src/ovirtcli/utils/autocompletionhelper.py
@@ -23,8 +23,14 @@
if args[key] != None:
vals = []
for val in args[key].split(','):
- if val and val != '': vals.append(val.strip())
-
+ if val and val != '': vals.append(
+ AutoCompletionHelper._resolve_value(
+ val.strip(),
+ common_options,
+ specific_options,
+ specific_arguments
+ )
+ )
if common_options:
vals.extend(common_options[:])
@@ -47,6 +53,21 @@
if specific_arguments.has_key(key):
mp[key].extend(specific_arguments[key])
return mp
+
+ @staticmethod
+ def _resolve_value(val, common_options=[], specific_options={},
specific_arguments={}):
+ return val + (
+ '-identifier ' if val not in common_options \
+ and (not
AutoCompletionHelper._is_verb_in_dict_values(
+ specific_options, val
+ )
+ )
+ and (not
AutoCompletionHelper._is_verb_in_dict_values(
+ specific_arguments, val
+ )
+ )
+ else ' '
+ )
@staticmethod
def _get_verb_replecations(container, text):
@@ -92,10 +113,7 @@
obj = spl[1].strip()
repl =
AutoCompletionHelper._get_verb_replecations(mp[obj], s_text)
i_completions = [('--' if (not
AutoCompletionHelper._is_verb_in_dict_values(specific_arguments, f)) else '')
- + f + ('-identifier ' if f not in
common_options \
- and (not
AutoCompletionHelper._is_verb_in_dict_values(specific_options, f))
- and (not
AutoCompletionHelper._is_verb_in_dict_values(specific_arguments, f))
- else ' ')
+ + f
if text in mp[obj] or repl == 1 or
len(mp[obj]) == 1
or
(len(mp[obj]) == 2 and 'None' in mp[obj]) == 1
else f
--
To view, visit http://gerrit.ovirt.org/21142
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9b1578dada8a3810bec766951e346c59abad61f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: cli_3.3
Gerrit-Owner: Michael Pasternak <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches