summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Donner <hans@hansdonner.nl>2018-10-06 10:35:37 +0200
committerGitHub <noreply@github.com>2018-10-06 10:35:37 +0200
commit32b5122d14d32c06c7db3a2923fe56a6331562e5 (patch)
treeddd8edc4e948cdaba5c9964e59e35ecf2583588c
parent3a8b1a0b11b9e6a60037f90c99dd288cecd09d3d (diff)
parent6bb4d17a92832701b9f064a6577488cc42d20645 (diff)
downloadgitlab-32b5122d14d32c06c7db3a2923fe56a6331562e5.tar.gz
Merge pull request #601 from max-wittig/fix/help-usage
fix(cli): print help and usage without config file
-rw-r--r--gitlab/cli.py6
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