[Yum-devel] [PATCH] completion helper: fix the "whitespace only" case. BZ 947827

Zdenek Pavlas zpavlas at redhat.com
Wed Apr 3 13:56:10 UTC 2013


Also noticed that patterns starting with quotes didn't work
(yum install "foo<tab>), fixed this as well.
---
 completion-helper.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/completion-helper.py b/completion-helper.py
index 999b9ad..e73db68 100755
--- a/completion-helper.py
+++ b/completion-helper.py
@@ -68,9 +68,12 @@ class RepoListCompletionCommand(yumcommands.RepoListCommand):
 
 
 def get_pattern(extcmds):
-    if len(extcmds) > 1 and extcmds[-1]:
-        try: return shlex.split(extcmds[-1])[0] + "*"
-        except ValueError: pass
+    if len(extcmds) > 1:
+        pat = extcmds[-1]
+        if pat and pat[0] in '\'"':
+            pat = pat[1:]
+        try: return shlex.split(pat)[0] + "*"
+        except (ValueError, IndexError): pass
     return "*"
 
 def main(args):
-- 
1.7.11.7



More information about the Yum-devel mailing list