diff options
| author | Max Wittig <max.wittig95@gmail.com> | 2018-10-02 19:56:53 +0200 |
|---|---|---|
| committer | Max Wittig <max.wittig@siemens.com> | 2018-10-04 09:23:55 +0200 |
| commit | 6bb4d17a92832701b9f064a6577488cc42d20645 (patch) | |
| tree | 529aa1e8f268a9abc47f1e26c9e2a157d8f7c891 /gitlab | |
| parent | ea71f1d121b723140671e2090182174234f0e2a1 (diff) | |
| download | gitlab-6bb4d17a92832701b9f064a6577488cc42d20645.tar.gz | |
fix(cli): print help and usage without config filefix/help-usage
Fixes #560
Diffstat (limited to 'gitlab')
| -rw-r--r-- | gitlab/cli.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gitlab/cli.py b/gitlab/cli.py index 4870192..e79ac6d 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -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") @@ -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 |
