diff options
author | Waldek Maleska <w.maleska@gmail.com> | 2022-07-04 09:31:56 +0100 |
---|---|---|
committer | John Villalovos <john@sodarock.com> | 2022-07-28 07:09:08 -0700 |
commit | 005ba93074d391f818c39e46390723a0d0d16098 (patch) | |
tree | 0c64c57bf7871856b9ad6f5545a2e964c462ccf3 /gitlab/v4/cli.py | |
parent | 1cf59323194b2352bd1c1313415cd09bbdddcc5f (diff) | |
download | gitlab-005ba93074d391f818c39e46390723a0d0d16098.tar.gz |
feat(cli): add a custom help formatter
Add a custom argparse help formatter that overrides the output
format to list items vertically.
The formatter is derived from argparse.HelpFormatter with minimal changes.
Co-authored-by: John Villalovos <john@sodarock.com>
Co-authored-by: Nejc Habjan <nejc.habjan@siemens.com>
Diffstat (limited to 'gitlab/v4/cli.py')
-rw-r--r-- | gitlab/v4/cli.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py index 90b6ba6..48369f6 100644 --- a/gitlab/v4/cli.py +++ b/gitlab/v4/cli.py @@ -377,7 +377,9 @@ def extend_parser(parser: argparse.ArgumentParser) -> argparse.ArgumentParser: for cls in sorted(classes, key=operator.attrgetter("__name__")): arg_name = cli.cls_to_gitlab_resource(cls) - object_group = subparsers.add_parser(arg_name) + object_group = subparsers.add_parser( + arg_name, formatter_class=cli.VerticalHelpFormatter + ) object_subparsers = object_group.add_subparsers( title="action", |