summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2013-05-18 17:11:37 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2013-05-18 17:11:37 +0200
commit204f6818b77cc3425e9bb137380fcbdfaa5f15df (patch)
tree3c3f004c5c88b32abb01363d9264730fa4ce66a6
parenta2059142b7c26aa13cf77c5b602c0941cdb30266 (diff)
downloadgitlab-204f6818b77cc3425e9bb137380fcbdfaa5f15df.tar.gz
describe the gitlab script in README
-rw-r--r--README.md75
1 files changed, 74 insertions, 1 deletions
diff --git a/README.md b/README.md
index da2cc2f..72a8925 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,8 @@ python-gitlab is a Python module providing access to the GitLab server API.
It supports the v3 api of GitLab.
+A CLI tool is also provided (called **gitlab**).
+
## Requirements
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
* Improve documentation
* Write unit tests
-* Write a command line tool to access GitLab servers
+* Improve the command line tool
## Code snippet
@@ -55,3 +57,74 @@ p.save()
print p
`````
+## Command line use
+
+To use the command line tool, you need to define which GitLab server(s) can be
+accessed. this can be done in 2 files:
+
+* /etc/python-gitlab.cfg
+* ~/.python-gitlab.cfg
+
+Here's an example of the syntax:
+
+`````
+[global]
+default = local
+
+[local]
+url = http://10.0.3.2:8080
+private_token = vTbFeqJYCY3sibBP7BZM
+
+[distant]
+url = https://some.whe.re
+private_token = thisisaprivatetoken
+`````
+
+The [global] section define which server is accesed by default.
+Each other section defines how to access a server. Only private token
+authentication is supported (not user/password).
+
+Choosing a different server than the default one can be done at run time:
+
+`````
+gitlab --gitlab=distant [command]
+`````
+
+gitlab always requires 2 mandatory arguments.
+
+The first argument is the object type on which we will act, the second one is
+the action:
+
+`````
+gitlab Project list
+`````
+
+The usable objects are those which inherits GitlabObject (yes, the source is
+the doc ATM), and the actions are list, get, create, update, delete.
+
+Some examples:
+
+`````bash
+# list all the projects:
+gitlab Project list
+
+# get a specific project (id 2):
+gitlab Project get 2
+
+# get a list of snippets for this project:
+gitlab ProjectIssue list project_id=2
+# (you're right, this syntax sucks)
+
+# delete a Snippet (id 3):
+gitlab ProjectSnippet delete 3 project_id=2
+
+# update a Snippet:
+gitlab ProjectSnippet update 4 project_id=2 code="My New Code"
+
+# create a Snippet:
+gitlab ProjectSnippet create project_id=2
+Impossible to create object (Missing attribute(s): title, file_name, code)
+
+# oops, let's add the attributes:
+gitlab ProjectSnippet create project_id=2 title="the title" file_name="the name" code="the code"
+`````