[Yum-devel] [PATCH] completion helper: fix the "whitespace only" case. BZ 947827
James Antill
james at fedoraproject.org
Wed Apr 3 15:20:45 UTC 2013
On Wed, 2013-04-03 at 15:56 +0200, Zdenek Pavlas wrote:
> 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:]
I would have hoped that the shell would solve this for you, but I guess
not. Given that we need to make it works for:
1. <'foo>
2. <'foo*'bar>
3. <'foo*'"bar>
...etc. My initial thought is to just remove all occurrences of ' and "
but maybe there is some python module function we can call?
More information about the Yum-devel
mailing list