Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9ca47aa

Browse files
author
Gauvain Pocentek
committed
gitlab: update the object syntax
1 parente7ba350 commit9ca47aa

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

‎README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,34 +95,37 @@ The first argument is the object type on which we will act, the second one is
9595
the action:
9696

9797
`````
98-
gitlabProject list
98+
gitlabproject list
9999
`````
100100

101101
The usable objects are those which inherits GitlabObject (yes, the source is
102-
the doc ATM), and the actions are list, get, create, update, delete.
102+
the doc ATM), with a bit of string transformation (Project => project,
103+
ProjectIssue => project-issue, ...).
104+
105+
The actions are list, get, create, update, delete.
103106

104107
Some examples:
105108

106109
`````bash
107110
# list all the projects:
108-
gitlabProject list
111+
gitlabproject list
109112

110113
# get a specific project (id 2):
111-
gitlabProject get --id=2
114+
gitlabproject get --id=2
112115

113116
# get a list of snippets for this project:
114-
gitlabProjectIssue list --project_id=2
117+
gitlabproject-issue list --project_id=2
115118

116119
# delete a Snippet (id 3):
117-
gitlabProjectSnippet delete --id=3 --project_id=2
120+
gitlabproject-snippet delete --id=3 --project_id=2
118121

119122
# update a Snippet:
120-
gitlabProjectSnippet update --id=4 --project_id=2 --code="My New Code"
123+
gitlabproject-snippet update --id=4 --project_id=2 --code="My New Code"
121124

122125
# create a Snippet:
123-
gitlabProjectSnippet create --project_id=2
126+
gitlabproject-snippet create --project_id=2
124127
Impossible to create object (Missing attribute(s): title, file_name, code)
125128

126129
# oops, let's add the attributes:
127-
gitlabProjectSnippet create --project_id=2 --title="the title" --file_name="the name" --code="the code"
130+
gitlabproject-snippet create --project_id=2 --title="the title" --file_name="the name" --code="the code"
128131
`````

‎gitlab

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ except:
8181
ifactionnotin ['get','list','update','create','delete']:
8282
die("Unknown action: %s"%action)
8383

84+
defwhatToCls(what):
85+
return"".join([s.capitalize()forsinwhat.split("-")])
86+
8487
try:
85-
cls=gitlab.__dict__[what]
88+
cls=gitlab.__dict__[whatToCls(what)]
8689
except:
8790
die("Unknown object: %s"%what)
8891

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp