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

Commit204f681

Browse files
author
Gauvain Pocentek
committed
describe the gitlab script in README
1 parenta205914 commit204f681

File tree

1 file changed

+74
-1
lines changed

1 file changed

+74
-1
lines changed

‎README.md

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ python-gitlab is a Python module providing access to the GitLab server API.
44

55
It supports the v3 api of GitLab.
66

7+
A CLI tool is also provided (called**gitlab**).
8+
79
##Requirements
810

911
Only Python 2 is supported for the moment.
@@ -18,7 +20,7 @@ python-gitlab is a work in progress, although already usable. Changes in the API
1820

1921
* Improve documentation
2022
* Write unit tests
21-
*Write a command line tool to access GitLab servers
23+
*Improve the command line tool
2224

2325
##Code snippet
2426

@@ -55,3 +57,74 @@ p.save()
5557
print p
5658
`````
5759

60+
##Command line use
61+
62+
To use the command line tool, you need to define which GitLab server(s) can be
63+
accessed. this can be done in 2 files:
64+
65+
* /etc/python-gitlab.cfg
66+
*~/.python-gitlab.cfg
67+
68+
Here's an example of the syntax:
69+
70+
`````
71+
[global]
72+
default = local
73+
74+
[local]
75+
url = http://10.0.3.2:8080
76+
private_token = vTbFeqJYCY3sibBP7BZM
77+
78+
[distant]
79+
url = https://some.whe.re
80+
private_token = thisisaprivatetoken
81+
`````
82+
83+
The[global] section define which server is accesed by default.
84+
Each other section defines how to access a server. Only private token
85+
authentication is supported (not user/password).
86+
87+
Choosing a different server than the default one can be done at run time:
88+
89+
`````
90+
gitlab --gitlab=distant [command]
91+
`````
92+
93+
gitlab always requires 2 mandatory arguments.
94+
95+
The first argument is the object type on which we will act, the second one is
96+
the action:
97+
98+
`````
99+
gitlab Project list
100+
`````
101+
102+
The usable objects are those which inherits GitlabObject (yes, the source is
103+
the doc ATM), and the actions are list, get, create, update, delete.
104+
105+
Some examples:
106+
107+
`````bash
108+
# list all the projects:
109+
gitlab Project list
110+
111+
# get a specific project (id 2):
112+
gitlab Project get 2
113+
114+
# get a list of snippets for this project:
115+
gitlab ProjectIssue list project_id=2
116+
# (you're right, this syntax sucks)
117+
118+
# delete a Snippet (id 3):
119+
gitlab ProjectSnippet delete 3 project_id=2
120+
121+
# update a Snippet:
122+
gitlab ProjectSnippet update 4 project_id=2 code="My New Code"
123+
124+
# create a Snippet:
125+
gitlab ProjectSnippet create project_id=2
126+
Impossible to create object (Missing attribute(s): title, file_name, code)
127+
128+
# oops, let's add the attributes:
129+
gitlab ProjectSnippet create project_id=2 title="the title" file_name="the name" code="the code"
130+
`````

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp