Fixup dedup_files and add some help/usage methods to config.
[pyutils.git] / src / pyutils / config.py
index 9655f251f2e30b47f7e17702be81fbf31246c07b..04e1498ac112e3b77a744ffdb188bcde239eaa66 100644 (file)
@@ -341,18 +341,31 @@ class Config:
         return False
 
     @staticmethod
-    def print_usage() -> None:
-        """Prints the normal help usage message out."""
-        ARGS.print_help()
+    def usage() -> str:
+        """
+        Returns:
+            full program usage help text as a string.
+        """
+        return ARGS.format_help()
 
     @staticmethod
-    def usage() -> str:
+    def short_usage() -> str:
         """
         Returns:
-            program usage help text as a string.
+            program short usage text as a string.
         """
         return ARGS.format_usage()
 
+    @staticmethod
+    def print_usage() -> None:
+        """Prints the full help usage message out."""
+        print(config.usage())
+
+    @staticmethod
+    def print_short_usage() -> None:
+        """Prints a short usage/help message."""
+        print(config.short_usage())
+
     @staticmethod
     def _reorder_arg_action_groups_before_help(entry_module: Optional[str]):
         """Internal.  Used to reorder the arguments before dumping out a
@@ -410,7 +423,7 @@ class Config:
         """
         return in_str.lower() in {"true", "1", "yes", "y", "t", "on"}
 
-    def _process_dynamic_args(self, event):
+    def _process_dynamic_args(self, event) -> None:
         """Invoked as a callback when a zk-based config changed."""
 
         if not self.zk:
@@ -763,9 +776,21 @@ def print_usage() -> None:
     Config.print_usage()
 
 
+def print_short_usage() -> None:
+    Config.print_short_usage()
+
+
 def usage() -> str:
     """
     Returns:
         program usage help text as a string.
     """
     return Config.usage()
+
+
+def short_usage() -> str:
+    """
+    Returns:
+        program short usage help text as a string.
+    """
+    return Config.short_usage()