File: cli.md

package info (click to toggle)
ruby-gitlab 6.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,824 kB
  • sloc: ruby: 12,742; makefile: 7; sh: 4; javascript: 3
file content (69 lines) | stat: -rw-r--r-- 1,154 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!-- THIS DOCUMENT IS PUBLISHED ON https://narkoz.github.io/gitlab -->
# CLI

> [!IMPORTANT]
> You need to set [environment variables](./configuration#environment-variables) before using the CLI.

## Commands

Send `gitlab` methods as commands, and parameters as arguments to the `gitlab`
command-line utility

```sh
gitlab users
```

```sh
gitlab user
```

```sh
gitlab user 2
```

## Filter

You can filter output by supplying `--only` or `--except` flags

```sh
gitlab user --only=id,email,name
```

```sh
gitlab users --except=id,email,name
```

> [!WARNING]
> Before executing destructive commands you will be prompted to confirm them.

## Additional commands

`help` lists all available actions

`shell` runs a shell to perform commands

`info` gives information about the environment

`-v` or `--version` shows the gem version

## Shell

You can perform commands in an interactive `gitlab` shell by running `gitlab shell`

```sh
gitlab shell

# list available commands
gitlab> help

# list groups
gitlab> groups

# protect a branch
gitlab> protect_branch 1 master

# quit shell
gitlab> exit
```

You can hit <kbd>tab</kbd> for command completion.