Skip to content

Commit

Permalink
Merge pull request #3 from linuskmr/1-use-__doc__-to-show-help-text
Browse files Browse the repository at this point in the history
Use .__doc__ to show help text
  • Loading branch information
linuskmr authored Sep 26, 2022
2 parents 99162c0 + 3354e61 commit 9de2237
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clipyarser/clipyarser.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def create_main_parser(self):
"""Creates the main ArgumentParser and includes the arguments of self._main_function."""
parser = ArgumentParser(prog=self.name, description=self.description)
if self._main_function:
parser.description = self._main_function.__doc__
Clipyarser.add_args(parser=parser, function=self._main_function)
return parser

Expand All @@ -69,6 +70,7 @@ def create_subparsers(self, parser: ArgumentParser):
for function_name, function in self._subcommand_functions.items():
# Create subparser for this function
subparser = subparsers.add_parser(function_name)
subparser.description = function.__doc__
Clipyarser.add_args(parser=subparser, function=function)

@staticmethod
Expand Down

0 comments on commit 9de2237

Please sign in to comment.