summaryrefslogtreecommitdiff
path: root/gitlab/cli.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-05-15 07:35:06 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2016-05-15 07:35:06 +0200
commitfd4539715da589df5a81b333e71875289687922d (patch)
tree68d3f3882680b1f6da370d3367286e72923f2c66 /gitlab/cli.py
parent417d27cf7c9569d5057dcced5481a6b9c8dfde2a (diff)
downloadgitlab-fd4539715da589df5a81b333e71875289687922d.tar.gz
Manage optional parameters for list() and get()
* List these elements in the API doc * Implement for License objects
Diffstat (limited to 'gitlab/cli.py')
-rw-r--r--gitlab/cli.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/gitlab/cli.py b/gitlab/cli.py
index 02dac8e..c7daceb 100644
--- a/gitlab/cli.py
+++ b/gitlab/cli.py
@@ -313,7 +313,7 @@ def _populate_sub_parser_by_class(cls, sub_parser):
sub_parser_action.add_argument("--page", required=False)
sub_parser_action.add_argument("--per-page", required=False)
- elif action_name in ["get", "delete"]:
+ if action_name in ["get", "delete"]:
if cls not in [gitlab.CurrentUser]:
if cls.getRequiresId:
id_attr = cls.idAttr.replace('_', '-')
@@ -323,7 +323,17 @@ def _populate_sub_parser_by_class(cls, sub_parser):
required=True)
for x in cls.requiredGetAttrs if x != cls.idAttr]
- elif action_name == "create":
+ if action_name == "get":
+ [sub_parser_action.add_argument("--%s" % x.replace('_', '-'),
+ required=False)
+ for x in cls.optionalGetAttrs]
+
+ if action_name == "list":
+ [sub_parser_action.add_argument("--%s" % x.replace('_', '-'),
+ required=False)
+ for x in cls.optionalListAttrs]
+
+ if action_name == "create":
[sub_parser_action.add_argument("--%s" % x.replace('_', '-'),
required=True)
for x in cls.requiredCreateAttrs]
@@ -331,7 +341,7 @@ def _populate_sub_parser_by_class(cls, sub_parser):
required=False)
for x in cls.optionalCreateAttrs]
- elif action_name == "update":
+ if action_name == "update":
id_attr = cls.idAttr.replace('_', '-')
sub_parser_action.add_argument("--%s" % id_attr,
required=True)