summaryrefslogtreecommitdiffstats
path: root/bin/portageq
diff options
context:
space:
mode:
authorAlec Warner <antarus@scriptkitty.com>2010-08-15 19:38:42 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-16 02:49:46 -0700
commit0b2c8ebafc5ec71e93620048a0627b9d7ed41c11 (patch)
tree6a0d67104496be6682a3f135bad69ba05e85298e /bin/portageq
parent7a27a491f3ad147fbd303bec64c596de6b8474ab (diff)
downloadportage-0b2c8ebafc5ec71e93620048a0627b9d7ed41c11.tar.gz
portage-0b2c8ebafc5ec71e93620048a0627b9d7ed41c11.tar.bz2
portage-0b2c8ebafc5ec71e93620048a0627b9d7ed41c11.zip
Add ability for portageq help to print valid metadata keys.
Diffstat (limited to 'bin/portageq')
-rwxr-xr-xbin/portageq19
1 files changed, 11 insertions, 8 deletions
diff --git a/bin/portageq b/bin/portageq
index ce72df046..77c102ed4 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -148,9 +148,6 @@ def mass_best_version(argv):
mass_best_version.uses_root = True
def metadata(argv):
- """<root> <pkgtype> <category/package> [<key>]+
- Returns metadata values for the specified package.
- """
if (len(argv) < 4):
print("ERROR: insufficient parameters!", file=sys.stderr)
sys.exit(2)
@@ -175,6 +172,12 @@ def metadata(argv):
print("Package not found: '%s'" % pkgspec, file=sys.stderr)
sys.exit(1)
+metadata.__doc__ = """
+<root> <pkgtype> <category/package> [<key>]+
+Returns metadata values for the specified package.
+Available keys: %s
+""" % ','.join(portage.auxdbkeys)
+
metadata.uses_root = True
def contents(argv):
@@ -587,25 +590,25 @@ def usage(argv):
# Show our commands -- we do this by scanning the functions in this
# file, and formatting each functions documentation.
#
-
+ help_mode = '--help' in sys.argv
for name in commands:
# Drop non-functions
obj = globals()[name]
doc = obj.__doc__
if (doc == None):
- print(" "+name)
+ print(" " + name)
print(" MISSING DOCUMENTATION!")
print("")
continue
lines = doc.split("\n")
- print(" "+name+" "+lines[0].strip())
+ print(" " + name + " " + lines[0].strip())
if (len(sys.argv) > 1):
- if ("--help" not in sys.argv):
+ if (not help_mode):
lines = lines[:-1]
for line in lines[1:]:
- print(" "+line.strip())
+ print(" " + line.strip())
if (len(sys.argv) == 1):
print("\nRun portageq with --help for info")