chiark / gitweb /
chpwd, subcommand.py: Only show global options in admin context help.
[chopwood] / chpwd
diff --git a/chpwd b/chpwd
index 52d3fa3a0d14db98f08d4b66a133f1226dbca9dd..07fe830a85b4bc920afebf9692f5dfc0fb6c0b0f 100755 (executable)
--- a/chpwd
+++ b/chpwd
@@ -90,6 +90,7 @@ def parse_options():
   """
   global OPTS
   OPTS, args = OPTPARSE.parse_args()
+  OPTPARSE.show_global_opts = False
   ## It's tempting to load the configuration here.  Don't do that.  Some
   ## contexts will want to check that the command line was handled properly
   ## upstream before believing it for anything, such as executing arbitrary
@@ -299,7 +300,9 @@ if __name__ == '__main__':
         if ctx is None: ctx = 'userv'
       else:
         D.opendb()
-        if ctx is None: ctx = 'admin'
+        if ctx is None:
+          ctx = 'admin'
+          OPTPARSE.show_global_opts = True
       with OUT.redirect_to(O.FileOutput()):
         OPTPARSE.dispatch(ctx, args)