Skip to content

Commit a0004eb

Browse files
committed
fetch parse description info from __doc__
1 parent c8c7306 commit a0004eb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tap/tap.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def __init__(self,
110110
# Indicate that initialization is complete
111111
self._initialized = True
112112

113+
self.description = self.__doc__ or ''
114+
113115
def _add_argument(self, *name_or_flags, **kwargs) -> None:
114116
"""Adds an argument to self (i.e. the super class ArgumentParser).
115117
@@ -311,6 +313,9 @@ def process_args(self) -> None:
311313

312314
def add_subparser(self, flag: str, subparser_type: type, **kwargs) -> None:
313315
"""Add a subparser to the collection of subparsers"""
316+
help_desc = kwargs.get('help', subparser_type.__doc__)
317+
kwargs['help'] = help_desc
318+
314319
self._subparser_buffer.append((flag, subparser_type, kwargs))
315320

316321
def _add_subparsers(self) -> None:

0 commit comments

Comments
 (0)