[yum-commits] completion-helper.py
Ville Skyttä
scop at osuosl.org
Wed Dec 12 20:02:18 UTC 2012
completion-helper.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 274ae25278a6e543b2cbd6ef38e35515c79a3c78
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Thu Oct 25 00:06:05 2012 +0300
bash completion: offer nvra instead of na strings for multi-install packages.
Helps dealing with packages with multiple versions installed/available etc.
diff --git a/completion-helper.py b/completion-helper.py
index 05801d1..999b9ad 100755
--- a/completion-helper.py
+++ b/completion-helper.py
@@ -41,14 +41,19 @@ class GroupsCompletionCommand(yumcommands.GroupsCommand):
class ListCompletionCommand(yumcommands.ListCommand):
def doCommand(self, base, basecmd, extcmds):
+ def printPkgs(pkgs):
+ for pkg in pkgs:
+ if base.allowedMultipleInstalls(pkg):
+ print pkg.nvra
+ else:
+ print pkg.na
+
ypl = base.doPackageLists(pkgnarrow=extcmds[0],
patterns=[get_pattern(extcmds)])
if extcmds[0] in ("installed", "all"):
- for pkg in ypl.installed:
- print pkg.na
+ printPkgs(ypl.installed)
if extcmds[0] in ("available", "all"):
- for pkg in ypl.available:
- print pkg.na
+ printPkgs(ypl.available)
class RepoListCompletionCommand(yumcommands.RepoListCommand):
def doCommand(self, base, basecmd, extcmds):
More information about the Yum-commits
mailing list