-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1061 from dirac-institute/CLI
add in extra message to tell the user how to get help when trying to use the CLI
- Loading branch information
Showing
6 changed files
with
62 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from argparse import ArgumentParser | ||
|
||
|
||
class SorchaArgumentParser(ArgumentParser): | ||
"""A subclass of the argparse.ArgumentParser that adds in a print statement | ||
to make it clearer how to get detailed help for new users who may not be | ||
as familiar with linux/unix""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
"""A subclass of the argparse.ArgumentParser that adds in a print statement | ||
to make it clearer how to get detailed help for new users who may not be | ||
as familiar with linux/unix | ||
Parameters | ||
----------- | ||
*args: Variable length argument list. | ||
**kwargs: Arbitrary keyword arguments. | ||
""" | ||
super().__init__(*args, **kwargs) | ||
|
||
def print_usage(self, file=None): | ||
"""Print a brief description of how the ArgumentParser should be invoked | ||
on the command line. If file is None, sys.stdout is assumed. | ||
Parameters | ||
----------- | ||
file: str or None | ||
Variable length argument list. | ||
Returns | ||
----------- | ||
None. | ||
""" | ||
super().print_usage(file) | ||
print(f"For more detailed help try: {self.prog} -h ", file=file) |