Skip to content

Commit

Permalink
fix(cli): print help and usage without config file
Browse files Browse the repository at this point in the history
Fixes #560
  • Loading branch information
max-wittig committed Oct 4, 2018
1 parent ea71f1d commit 6bb4d17
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gitlab/cli.py
Expand Up @@ -98,7 +98,7 @@ def _get_base_parser(add_help=True):
"will be used."),
required=False)
parser.add_argument("-o", "--output",
help=("Output format (v4 only): json|legacy|yaml"),
help="Output format (v4 only): json|legacy|yaml",
required=False,
choices=['json', 'legacy', 'yaml'],
default="legacy")
Expand Down Expand Up @@ -135,6 +135,10 @@ def main():
exit(0)

parser = _get_base_parser(add_help=False)
if "--help" in sys.argv or "-h" in sys.argv:
parser.print_help()
exit(0)

# This first parsing step is used to find the gitlab config to use, and
# load the propermodule (v3 or v4) accordingly. At that point we don't have
# any subparser setup
Expand Down

0 comments on commit 6bb4d17

Please sign in to comment.