Skip to content

Commit e440337

Browse files
authored
Merge pull request #811 from bmeneg/fix-readme
README: overhaul file structure
2 parents 3681b4a + 3371ecd commit e440337

1 file changed

Lines changed: 115 additions & 56 deletions

File tree

README.md

Lines changed: 115 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,64 @@
1-
# git + <img src="https://user-images.githubusercontent.com/3167497/34473826-40b4987c-ef2c-11e7-90b9-5ff322c4966f.png" width="30" height="30"> = gitlab [![Build Status](https://travis-ci.org/zaquestion/lab.svg?branch=master)](https://travis-ci.org/zaquestion/lab) [![Go Report Card](https://goreportcard.com/badge/github.com/zaquestion/lab)](https://goreportcard.com/report/github.com/zaquestion/lab) [![codecov](https://codecov.io/gh/zaquestion/lab/branch/master/graph/badge.svg)](https://codecov.io/gh/zaquestion/lab) [![Join the chat at https://gitter.im/labcli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/labcli) [![CC0 License](http://i.creativecommons.org/p/zero/1.0/88x31.png)](https://creativecommons.org/share-your-work/public-domain/cc0/) [![Donate](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/zaquestion/donate)
1+
<p align="center">
2+
<p align="center">
3+
git + <img src="https://user-images.githubusercontent.com/3167497/34473826-40b4987c-ef2c-11e7-90b9-5ff322c4966f.png" width="100" height="100"> = gitlab
4+
</p>
5+
<p align="center">
6+
<a href="https://travis-ci.org/zaquestion/lab">
7+
<img src="https://travis-ci.org/zaquestion/lab.svg?branch=master" alt="Build Status">
8+
</a>
9+
<a href="https://goreportcard.com/report/github.com/zaquestion/lab">
10+
<img src="https://goreportcard.com/badge/github.com/zaquestion/lab" alt="Go Report Card">
11+
</a>
12+
<a href="https://codecov.io/gh/zaquestion/lab">
13+
<img src="https://codecov.io/gh/zaquestion/lab/branch/master/graph/badge.svg" alt="codecov">
14+
</a>
15+
<a href="https://gitter.im/labcli">
16+
<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat">
17+
</a>
18+
</p>
19+
<p align="center">
20+
<a href="https://liberapay.com/zaquestion/donate">
21+
<img src="https://liberapay.com/assets/widgets/donate.svg" alt="Donate">
22+
</a>
23+
</p>
24+
<p align="center">
25+
<img src="https://user-images.githubusercontent.com/1964720/42740177-6478d834-8858-11e8-9667-97f193ecb404.gif" align="center">
26+
</p>
27+
</p>
228

3-
<p align="center"><img src="https://user-images.githubusercontent.com/1964720/42740177-6478d834-8858-11e8-9667-97f193ecb404.gif" align="center"></p>
29+
_lab_ interacts with repositories on GitLab, including creating/editing merge requests, issues, milestones, snippets
30+
and CI pipelines.
431

5-
Lab wraps Git, making it simple to clone, fork, and interact with repositories on GitLab, including seamless workflows for creating merge requests, issues and snippets.
32+
The development team has focused on keeping _lab_ a simple and intuitive command line interface for commands provided
33+
in the [GitLab API](https://docs.gitlab.com/ee/api/api_resources.html). _lab_'s aim is to provide GitLab users an
34+
experience similar to the GitLab WebUI with respect to errors and messages.
635

7-
```
8-
$ lab clone gitlab-com/infrastructure
36+
# Usage recommendation
937

10-
# expands to:
11-
$ git clone git@gitlab.com:gitlab-com/infrastructure
38+
One can use _lab_ as a Git alias, integrating seamlessly to their Git workflow.
39+
```
40+
$ cat ~/.gitconfig
41+
...
42+
[alias]
43+
lab = "!lab"
44+
lab-i = "!lab issue"
45+
li = "!lab issue"
46+
47+
$ git lab mr list
48+
$ git lab-i close
49+
$ git li create
1250
```
1351

14-
# Inspiration
52+
Also, _lab_ can be set as shell aliases:
1553

16-
The [hub](https://github.com/github/hub) tool made my life significantly easier and still does! lab is heavily inspired by hub and attempts to provide a similar feel.
54+
```bash
55+
alias mrlist="lab mr list"
56+
```
1757

1858
# Installation
1959

20-
Dependencies
21-
22-
* `git`
60+
In compilation-time, _lab_ depends only on other Go external modules, defined at go.mod. At runtime, _git_ is required
61+
as many git commands are used by _lab_ to retrieve local repository information.
2362

2463
### Homebrew
2564
```
@@ -43,28 +82,30 @@ apk add lab
4382
```
4483

4584
### Bash
85+
In case you don't want to install _lab_ using any of the above package managers you can use the Bash script available:
86+
87+
> :warning: The script will install _lab_ into `/usr/local/bin/`.
4688
47-
Installs lab into `/usr/local/bin/`
4889
```
4990
curl -s https://raw.githubusercontent.com/zaquestion/lab/master/install.sh | sudo bash
5091
```
51-
NOTE: Please take care when executing scripts in this fashion. Make sure you
52-
trust the developer providing the script and consider peeking at the install
53-
script itself (ours is pretty simple ;)
92+
93+
> :warning: Please take care when executing scripts in this fashion. Make sure you trust the developer providing the
94+
> script and consider peeking at the install script itself (ours is pretty simple ;)
5495
5596
### PreBuilt Binaries
5697

5798
Head to the [releases](https://github.com/zaquestion/lab/releases) page and download your preferred release
5899

59100
### Source
60101

61-
Required
62-
* [Go 1.15+](https://golang.org/doc/install)
102+
For building _lab_ from source it's required [Go 1.17+](https://golang.org/doc/install). Older versions (ie. 1.15)
103+
might still be able to build _lab_, but warnings related to unsupported `go.mod` format might be prompted.
63104

64105
```
65106
git clone git@github.com:zaquestion/lab
66107
cd lab
67-
go install -ldflags "-X \"main.version=$(git rev-parse --short=10 HEAD)\"" .
108+
go install -ldflags "-X \"main.version=$(git rev-parse --short=10 HEAD)\"" .
68109
```
69110

70111
or
@@ -73,27 +114,49 @@ or
73114
make install
74115
```
75116

76-
### Tests
77-
See the [contribution guide](CONTRIBUTING.md).
78-
79117
# Configuration
80118

81-
`lab` needs your GitLab information in order to interact with to your GitLab
82-
instance. There are several ways to provide this information to `lab`:
119+
_lab_ needs your GitLab information in order to interact with to your GitLab instance. There are several ways to
120+
provide this information to `lab`:
83121

84-
1. environment variables: `CI_PROJECT_URL`, `CI_JOB_TOKEN`, `GITLAB_USER_LOGIN`;
85-
- Note: these are meant for when `lab` is running within a GitLab CI pipeline
86-
- If all of these variables are set, the config files will not be updated.
87-
- If all of these variables are set, these take precedence over all other values.
88-
2. environment variables: `LAB_CORE_HOST`, `LAB_CORE_TOKEN`;
89-
- If these variables are set, the config files will not be updated.
90-
- For example to use gitlab.com do: `export LAB_CORE_HOST="https://gitlab.com"`
91-
3. local configuration file in [Tom's Obvious, Minimal Language (TOML)](https://github.com/toml-lang/toml): `./lab.toml`;
92-
- No other config files will be used as overrides if a local configuration file is specified
93-
4. user-specific configuration file in TOML: `~/.config/lab/lab.toml`.
94-
- An example of user-specfic configurations in lab.toml can be found below. As seen in the example file below, any command options specified by --help (for example 'lab mr show --help', or 'lab issue edit --help') can be set in the configuration file using TOML format.
122+
### Fresh start
95123

124+
When _lab_ is executed for the first time, no suitable configuration found, it will prompt for your GitLab information.
125+
For example:
126+
127+
```
128+
$ lab
129+
Enter default GitLab host (default: https://gitlab.com):
130+
Enter default GitLab token:
96131
```
132+
133+
These informations are going to be save it into `~/.config/lab/lab.toml` and won't be asked again.
134+
In case multiple projects require different information (ie. _gitlab.com_ and a self-hosted GitLab service), using
135+
different configuration files as explained in the section below.
136+
137+
### Configuration file
138+
139+
The most common option is to use _lab_ configuration files, which can be placed in different places in an hierarchical
140+
style. The [Tom's Obvious, Minimal Language (TOML)](https://github.com/toml-lang/toml) is used for the configuration
141+
file.
142+
143+
When a local configuration file is present (`./lab.toml`), no other configuration file will be checked, this will be
144+
the only one used for looking up required information.
145+
146+
However, other two options are possible:
147+
148+
1. User-specific: `~/.config/lab/lab.toml`
149+
2. Worktree-specific: `.git/lab/lab.toml`
150+
151+
These two files are merged before _lab_ runs, meaning that they're complementary to each other. One thing is important
152+
to note though, options set in the worktree configuration file overrides (take precedence over) any value set in the
153+
user-specific file.
154+
155+
An example of user-specific configurations can be found below. As seen in the example file below, any command options
156+
specified by `--help` (for example `lab mr show --help`, or `lab issue edit --help`) can be set in the configuration
157+
file using TOML format.
158+
159+
```toml
97160
[core]
98161
host = "https://gitlab.com"
99162
token = "1223334444555556789K"
@@ -110,28 +173,23 @@ instance. There are several ways to provide this information to `lab`:
110173
force-linebreak = true
111174
```
112175

113-
5. work-tree configuration file in TOML: `.git/lab/lab.toml`. The values in
114-
this file will override any values set in the user-specific configuration file.
176+
### Local environment variables
115177

116-
If no suitable config values are found, `lab` will prompt for your GitLab
117-
information and save it into `~/.config/lab/lab.toml`.
118-
For example:
178+
If running _lab_ locally, the variables `LAB_CORE_HOST` and `LAB_CORE_TOKEN` can be used, preventing configuration file
179+
creation/update. For example to use _gitlab.com_ do:
119180
```
120-
$ lab
121-
Enter default GitLab host (default: https://gitlab.com):
122-
Enter default GitLab token:
181+
export LAB_CORE_HOST="https://gitlab.com"
123182
```
124183

125-
Command-specific flags can be set in the config files.
184+
### CI environment variables
126185

127-
```
128-
[mr_show]
129-
comments = true # sets --comments on 'mr show' commands
186+
The environment variables `CI_PROJECT_URL`, `CI_JOB_TOKEN` and `GITLAB_USER_LOGIN`, intended to be used in a CI
187+
environment, can be set to prevent any configuration file creation/update. Also, any of these take precedence over all
188+
other options.
130189

131-
```
132190
# Completions
133191

134-
`lab` provides completions for [Bash], [Elvish], [Fish], [Oil], [Powershell], [Xonsh] and [Zsh].
192+
_lab_ provides completions for [Bash], [Elvish], [Fish], [Oil], [Powershell], [Xonsh] and [Zsh].
135193
Scripts can be directly sourced (though using pre-generated versions is recommended to avoid shell startup delay):
136194

137195
```sh
@@ -159,17 +217,18 @@ exec($(lab completion xonsh))
159217
source <(lab completion zsh)
160218
```
161219

162-
## What about [GLab](https://github.com/profclems/glab)?
220+
# Contributing
163221

164-
Both [glab] and `lab` are open-source tools with the same goal of bringing GitLab to your command line and simplifying the developer workflow. In many ways `lab` is to [hub], what [glab] is to [gh].
222+
We welcome all contributors and their contributions to _lab_! See the [contribution guide](CONTRIBUTING.md).
165223

166-
`lab` aims to feel familiar to a `git` user and leverages `git` to power many of it's commands. `glab` will feel more familiar to `gh` users and in turn is more interactive and likely more beginner friendly for that reason.
224+
# What about [GLab](https://github.com/profclems/glab)?
167225

226+
Both [glab] and `lab` are open-source tools with the same goal of bringing GitLab to your command line and simplifying
227+
the developer workflow. In many ways `lab` is to [hub], what [glab] is to [gh].
168228

169-
```
170-
$ lab
171-
Enter GitLab host (default: https://gitlab.com):
172-
```
229+
If you're looking for a tool like _hub_, less opinionated, that feels like using _git_ and allows you to interact with
230+
GitLab then _lab_ is for you. However, if you're looking for a more opinionated tool intended to simplify your GitLab
231+
workflows, you might consider using [glab].
173232

174233
<p align="center"><img src="https://user-images.githubusercontent.com/2358914/34196973-420d389a-e519-11e7-92e6-3a1486d6b280.png" align="center"></p>
175234

0 commit comments

Comments
 (0)