From 9fed6ec412d3e7e64ee46b72fa91820db55fac4b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 8 Aug 2009 21:34:52 +0000 Subject: [PATCH] Simplify command introspection inside usage(). svn path=/main/trunk/; revision=13951 --- bin/portageq | 9 +++------ 1 file 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): -- 2.26.2