László Attila Tóth <laszlo.attila.t...@gmail.com> added the comment:

Checking the code the add_mutually_exclusive_group has only kwargs, so one part 
can be fixed (POC, breaks tests):

--- Lib/argparse.py
+++ Lib/argparse.py
@@ -1648,8 +1648,8 @@ def _remove_action(self, action):

 class _MutuallyExclusiveGroup(_ArgumentGroup):

-    def __init__(self, container, required=False):
-        super(_MutuallyExclusiveGroup, self).__init__(container)
+    def __init__(self, container, required=False, title=None, 
description=None):
+        super(_MutuallyExclusiveGroup, self).__init__(container, title, 
description)
         self.required = required
         self._container = container

@@ -2529,6 +2529,14 @@ def format_help(self):
             formatter.add_arguments(action_group._group_actions)
             formatter.end_section()

+        for mutual_group in self._mutually_exclusive_groups:
+            if not mutual_group.title:
+                continue
+            formatter.start_section(mutual_group.title)
+            formatter.add_text(mutual_group.description)
+            formatter.add_arguments(mutual_group._group_actions)
+            formatter.end_section()
+
         # epilog
         formatter.add_text(self.epilog)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46058>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to