Skip to content

Commit 0d83ad5

Browse files
committed
rimport: Add help using new shared function.
1 parent 748692a commit 0d83ad5

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

rimport

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,8 @@ def build_parser() -> argparse.ArgumentParser:
8383
# Add verbosity options
8484
shared.add_parser_verbosity_group(parser)
8585

86-
# Provide -help to mirror legacy behavior (in addition to -h and --help)
87-
parser.add_argument(
88-
"-h",
89-
"--help",
90-
"-help",
91-
action="help",
92-
help="Show this help message and exit",
93-
)
86+
# Add help text
87+
shared.add_help(parser)
9488

9589
return parser
9690

shared.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ def add_inputdata_root(parser: argparse.ArgumentParser):
5353
)
5454

5555

56+
def add_help(parser: argparse.ArgumentParser):
57+
"""Add help option to an argument parser.
58+
59+
Provides -help to mirror legacy rimport behavior (in addition to -h and --help).
60+
61+
Args:
62+
parser: ArgumentParser instance to add the help arg to.
63+
"""
64+
parser.add_argument(
65+
"-h",
66+
"--help",
67+
"-help",
68+
action="help",
69+
help="Show this help message and exit",
70+
)
71+
72+
5673
def add_parser_verbosity_group(parser: argparse.ArgumentParser):
5774
"""Add mutually exclusive verbosity options to an argument parser.
5875

0 commit comments

Comments
 (0)