Teach site_location about the .local hostname suffix that the mac
[python_utils.git] / config.py
index b2e62c0d0a6e0893e372c8d3334868f2de4ed5ee..57593c3a33c01505bd87918be3591459b508743f 100644 (file)
--- a/config.py
+++ b/config.py
@@ -172,7 +172,7 @@ def is_flag_already_in_argv(var: str):
     return False
 
 
-def reorder_arg_action_groups(entry_module: Optional[str]):
+def reorder_arg_action_groups_before_help(entry_module: Optional[str]):
     reordered_action_groups = []
     for grp in ARGS._action_groups:
         if entry_module is not None and entry_module in grp.title:  # type: ignore
@@ -269,7 +269,9 @@ def parse(entry_module: Optional[str]) -> Dict[str, Any]:
     # screen w/o scrolling.
     for arg in sys.argv:
         if arg in ('--help', '-h'):
-            ARGS._action_groups = reorder_arg_action_groups(entry_module)
+            if entry_module is not None:
+                entry_module = os.path.basename(entry_module)
+            ARGS._action_groups = reorder_arg_action_groups_before_help(entry_module)
 
     # Examine the environment for variables that match known flags.
     # For a flag called --example_flag the corresponding environment
@@ -327,5 +329,6 @@ def dump_config():
 def late_logging():
     """Log messages saved earlier now that logging has been initialized."""
     logger = logging.getLogger(__name__)
+    logger.debug('Original commandline was: %s', ORIG_ARGV)
     for _ in SAVED_MESSAGES:
         logger.debug(_)