github.com/zaquestion/lab@v0.25.1/README.md (about) 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> 28 29 _lab_ interacts with repositories on GitLab, including creating/editing merge requests, issues, milestones, snippets 30 and CI pipelines. 31 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. 35 36 # Usage recommendation 37 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 50 ``` 51 52 Also, _lab_ can be set as shell aliases: 53 54 ```bash 55 alias mrlist="lab mr list" 56 ``` 57 58 # Installation 59 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. 62 63 ### Homebrew 64 ``` 65 brew install lab 66 ``` 67 68 ### NixOS 69 ``` 70 nix-env -f '<nixpkgs>' -iA gitAndTools.lab 71 ``` 72 73 ### Scoop 74 ``` 75 scoop bucket add zaquestion https://github.com/zaquestion/scoop-bucket.git 76 scoop install lab 77 ``` 78 79 ### Alpine 80 ``` 81 apk add lab 82 ``` 83 84 ### 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/`. 88 89 ``` 90 curl -s https://raw.githubusercontent.com/zaquestion/lab/master/install.sh | sudo bash 91 ``` 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 ;) 95 96 ### PreBuilt Binaries 97 98 Head to the [releases](https://github.com/zaquestion/lab/releases) page and download your preferred release 99 100 ### Source 101 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. 104 105 ``` 106 git clone git@github.com:zaquestion/lab 107 cd lab 108 go install -ldflags "-X \"main.version=$(git rev-parse --short=10 HEAD)\"" . 109 ``` 110 111 or 112 113 ``` 114 make install 115 ``` 116 117 # Configuration 118 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`: 121 122 ### Fresh start 123 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: 131 ``` 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 160 [core] 161 host = "https://gitlab.com" 162 token = "1223334444555556789K" 163 user = "yourusername" 164 165 [mr_checkout] 166 force = true 167 168 [mr_create] 169 force-linebreak = true 170 draft = true 171 172 [mr_edit] 173 force-linebreak = true 174 ``` 175 176 ### Local environment variables 177 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: 180 ``` 181 export LAB_CORE_HOST="https://gitlab.com" 182 ``` 183 184 ### CI environment variables 185 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. 189 190 # Completions 191 192 _lab_ provides completions for [Bash], [Elvish], [Fish], [Oil], [Powershell], [Xonsh] and [Zsh]. 193 Scripts can be directly sourced (though using pre-generated versions is recommended to avoid shell startup delay): 194 195 ```sh 196 # bash (~/.bashrc) 197 source <(lab completion) 198 199 # elvish (~/.elvish/rc.elv) 200 eval (lab completion|slurp) 201 202 # fish (~/.config/fish/config.fish) 203 lab completion | source 204 205 # oil 206 source <(lab completion) 207 208 # powershell (~/.config/powershell/Microsoft.PowerShell_profile.ps1) 209 Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete 210 lab completion | Out-String | Invoke-Expression 211 212 # xonsh (~/.config/xonsh/rc.xsh) 213 COMPLETIONS_CONFIRM=True 214 exec($(lab completion xonsh)) 215 216 # zsh (~/.zshrc) 217 source <(lab completion zsh) 218 ``` 219 220 # Contributing 221 222 We welcome all contributors and their contributions to _lab_! See the [contribution guide](CONTRIBUTING.md). 223 224 # What about [GLab](https://github.com/profclems/glab)? 225 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]. 228 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]. 232 233 <p align="center"><img src="https://user-images.githubusercontent.com/2358914/34196973-420d389a-e519-11e7-92e6-3a1486d6b280.png" align="center"></p> 234 235 <p xmlns:dct="http://purl.org/dc/terms/"> 236 <a rel="license" 237 href="http://creativecommons.org/publicdomain/zero/1.0/"> 238 <img src="https://licensebuttons.net/p/zero/1.0/88x31.png" style="border-style: none;" alt="CC0" /> 239 </a> 240 <br /> 241 To the extent possible under law, 242 <a rel="dct:publisher" 243 href="https://github.com/zaquestion/lab"> 244 <span property="dct:title">Zaq? Wiedmann</span></a> 245 has waived all copyright and related or neighboring rights to 246 <span property="dct:title">Lab</span>. 247 This work is published from: 248 <span property="vcard:Country" datatype="dct:ISO3166" 249 content="US" about="https://github.com/zaquestion/lab"> 250 United States</span>. 251 </p> 252 253 254 255 256 [Bash]:https://www.gnu.org/software/bash/ 257 [Elvish]:https://elv.sh/ 258 [Fish]:https://fishshell.com/ 259 [Oil]:http://www.oilshell.org/ 260 [Powershell]:https://microsoft.com/powershell 261 [Xonsh]:https://xon.sh/ 262 [Zsh]:https://www.zsh.org/ 263 264 [gh]:https://github.com/cli/cli 265 [hub]:https://github.com/github/hub 266 [lab]:https://github.com/zaquestion/lab 267 [glab]:https://github.com/profclems/glab