Skip to content

Commit 6bb4d17

Browse files
committed
fix(cli): print help and usage without config file
Fixes #560
1 parent ea71f1d commit 6bb4d17

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gitlab/cli.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def _get_base_parser(add_help=True):
9898
"will be used."),
9999
required=False)
100100
parser.add_argument("-o", "--output",
101-
help=("Output format (v4 only): json|legacy|yaml"),
101+
help="Output format (v4 only): json|legacy|yaml",
102102
required=False,
103103
choices=['json', 'legacy', 'yaml'],
104104
default="legacy")
@@ -135,6 +135,10 @@ def main():
135135
exit(0)
136136

137137
parser = _get_base_parser(add_help=False)
138+
if "--help" in sys.argv or "-h" in sys.argv:
139+
parser.print_help()
140+
exit(0)
141+
138142
# This first parsing step is used to find the gitlab config to use, and
139143
# load the propermodule (v3 or v4) accordingly. At that point we don't have
140144
# any subparser setup

0 commit comments

Comments
 (0)