summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-08 21:34:52 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-08 21:34:52 +0000
commit9fed6ec412d3e7e64ee46b72fa91820db55fac4b (patch)
tree81e308b778df7716eb791ad6d99ef441519988ee
parente7fb86bb57367571be419110ae263e4fb19cc2d7 (diff)
downloadportage-9fed6ec412d3e7e64ee46b72fa91820db55fac4b.tar.gz
portage-9fed6ec412d3e7e64ee46b72fa91820db55fac4b.tar.bz2
portage-9fed6ec412d3e7e64ee46b72fa91820db55fac4b.zip
Simplify command introspection inside usage().
svn path=/main/trunk/; revision=13951
-rwxr-xr-xbin/portageq9
1 files changed, 3 insertions, 6 deletions
diff --git a/bin/portageq b/bin/portageq
index 084c20cbb..a166eb2b5 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -534,16 +534,13 @@ def usage(argv):
# Show our commands -- we do this by scanning the functions in this
# file, and formatting each functions documentation.
#
- commands = [x for x in globals() if x not in \
- ("usage", "__doc__", "__name__", "main", "os", "portage", \
- "sys", "__builtins__", "types", "string","exithandler")]
- commands.sort()
+ commands = sorted(k for k, v in globals().iteritems() \
+ if type(v) is types.FunctionType and \
+ k not in ('usage', 'main', 'exithandler'))
for name in commands:
# Drop non-functions
obj = globals()[name]
- if (type(obj) != types.FunctionType):
- continue
doc = obj.__doc__
if (doc == None):