summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-06-05 19:52:42 -0700
committerZac Medico <zmedico@gentoo.org>2011-06-05 19:52:42 -0700
commit81bd25882a4e3dc39751e915fecadae7d7368662 (patch)
treed8f0e58e360505633907068d837582409ba00765
parente717c4429dc00950a8e5840ecce8b4b6fce2d059 (diff)
downloadportage-81bd25882a4e3dc39751e915fecadae7d7368662.tar.gz
portage-81bd25882a4e3dc39751e915fecadae7d7368662.tar.bz2
portage-81bd25882a4e3dc39751e915fecadae7d7368662.zip
portageq: support --version
-rwxr-xr-xbin/portageq13
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/portageq b/bin/portageq
index 92719fb5b..fa713889a 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -719,13 +719,18 @@ def main():
if nocolor in ('yes', 'true'):
portage.output.nocolor()
- if "-h" in sys.argv or "--help" in sys.argv:
- usage(sys.argv)
- sys.exit(os.EX_OK)
- elif len(sys.argv) < 2:
+ if len(sys.argv) < 2:
usage(sys.argv)
sys.exit(os.EX_USAGE)
+ for x in sys.argv:
+ if x in ("-h", "--help"):
+ usage(sys.argv)
+ sys.exit(os.EX_OK)
+ elif x == "--version":
+ print("Portage", portage.VERSION)
+ sys.exit(os.EX_OK)
+
cmd = sys.argv[1]
function = globals().get(cmd)
if function is None or cmd not in commands: