glab

module
v1.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2020 License: MIT

README ΒΆ

GLab

Go Report Card codecov pipeline status Documentation Status Gitter

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching between windows and browser tabs. Work with issues, merge requests, watch running pipelines directly from your CLI among other features. Inspired by gh, the official GitHub CLI tool.

glab is available for repositories hosted on GitLab.com and self-hosted GitLab Instances. glab supports multiple authenticated GitLab instances and automatically detects the authenticated hostname from the remotes available in the working git directory.

image

Table of Contents

Usage

glab <command> <subcommand> [flags]
Core Commands
  api:         Make authenticated REST/GRAPHQL requests to the GitLab API
  auth:        Manage glab's authentication state
  issue:       Work with GitLab issues
  label:       Manage labels on remote
  mr:          Create, view and manage merge requests
  ci:          Work with GitLab CI pipelines and jobs
  release:     Manage GitLab releases
  repo:        Work with GitLab repositories and projects
  
Additional Commands
  alias:       Create, list and delete aliases
  check-update: Check for latest glab releases
  completion:  Generate shell completion scripts
  config:      Set and get glab settings
  help:        Help about any command
  version:     show glab version information
Examples
$ glab issue create --title="This is an issue title" --description="This is a really long description"
$ glab issue list --closed
$ glab ci view -b master    # to watch the latest pipeline on master
$ glab ci status    # classic ci view

Demo

asciicast

Learn More

Read the documentation for more information on this tool.

Installation

Download a binary suitable for your OS at the releases page.

Quick Install (Bash)

You can install or update glab with:

curl -sL https://j.mp/glab-i | sudo bash

or

curl -s https://raw.githubusercontent.com/profclems/glab/trunk/scripts/quick_install.sh | sudo bash

Installs into usr/local/bin

NOTE: Please take care when running scripts in this fashion. Consider peaking at the install script itself and verify that it works as intended.

Windows

Available for download via WinGet, scoop, or downloadable EXE installer file.

WinGet
winget install glab

Updating:

winget install glab
Scoop
scoop install glab

Updating:

scoop update glab
EXE Installer

EXE installers are available for download on the releases page.

Linux

Prebuilt binaries available at the releases page.

Linuxbrew (Homebrew)
brew install glab

Updating:

brew upgrade glab
Snapcraft

Get it from the Snap Store

Make sure you have snap installed on your Linux Distro (https://snapcraft.io/docs/installing-snapd).

  1. sudo snap install --edge glab
  2. sudo snap connect glab:ssh-keys to grant ssh access
Arch Linux

glab is available through the gitlab-glab-bin package on the AUR or download and install an archive from the releases page. Arch Linux also supports snap.

pacman -Sy gitlab-glab-bin
KISS Linux

glab is available on the KISS Linux Community Repo as gitlab-glab. If you already have the community repo configured in your KISS_PATH you can install glab through your terminal.

kiss b gitlab-glab && kiss i gitlab-glab

If you do not have the community repo configured in your KISS_PATH, follow the guide on the official guide Here to learn how to setup it up.

Alpine Linux

glab is available on the Alpine Community Repo as glab.

Warning: The package is currently only available under the edge. edge is under constant development so be careful using it in production. It is possible that bugs in edge could cause data loss or could break your system.

Install a pinned version from edge

To ensure that by default edge will be used to get the latest updates. We need the edge repository under /etc/apk/repositories.

Afterwards you can install it with apk add --no-cache glab@edge

We use --no-cache so we don't need to do an apk update before.

echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
apk add --no-cache glab@edge
Alpine Linux Docker-way

Use edge directly

FROM alpine:edge
RUN apk add --no-cache glab

Use for a stable version of alpine linux but glab from edge. This is neccesary until alpine:3.13

FROM alpine:3.12
RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk add --no-cache glab@edge
MacOS

glab is available via Homebrew

Homebrew
brew install glab

Updating:

brew upgrade glab
Building From Source

If a supported binary for your OS is not found at the releases page, you can build from source:

Prerequisites for building from source are:
  • make
  • Go 1.13+
  1. Verify that you have Go 1.13+ installed

    $ go version
    go version go1.14
    

    If go is not installed, follow instructions on the Go website.

  2. Clone this repository

    $ git clone https://github.com/profclems/glab.git
    $ cd glab
    

    If you have $GOPATH/bin or $GOBIN in your $PATH, you can just install with make install (install glab in $GOPATH/bin) and skip steps 3 and 4.

  3. Build the project

    $ make
    
  4. Move the resulting bin/glab executable to somewhere in your PATH

    $ sudo mv ./bin/glab /usr/local/bin/
    
  5. Run glab version to check if it worked and glab config init to set up

Authentication

Get a GitLab access token at https://gitlab.com/profile/personal_access_tokens or https://gitlab.example.com/profile/personal_access_tokens if self-hosted

  • start interactive setup
$ glab auth login
  • authenticate against gitlab.com by reading the token from a file
$ glab auth login --stdin < myaccesstoken.txt
  • authenticate against a self-hosted GitLab instance by reading from a file
$ glab auth login --hostname salsa.debian.org --stdin < myaccesstoken.txt
  • authenticate with token and hostname (Not recommended for shared environments)
$ glab auth login --hostname gitlab.example.org --token xxxxx

Configuration

glab follows the XDG Base Directory Spec: global configuration file is saved at ~/.config/glab-cli. Local configuration file is saved at the root of the working git directory and automatically added to .gitignore.

To set configuration globally

$ glab config set --global editor vim

To set configuration for current directory (must be a git repository)

$ glab config set editor vim

To set configuration for a specific host

Use the --host flag to set configuration for a specific host. This is always stored in the global config file with or without the global flag.

$ glab config set editor vim --host gitlab.example.org

Environment Variables

GITLAB_TOKEN: an authentication token for API requests. Setting this avoids being
prompted to authenticate and overrides any previously stored credentials.
Can be set in the config with 'glab config set token xxxxxx'

GITLAB_URI or GITLAB_HOST: specify the url of the gitlab server if self hosted (eg: https://gitlab.example.com). Default is https://gitlab.com.

REMOTE_ALIAS or GIT_REMOTE_URL_VAR: git remote variable or alias that contains the gitlab url.
Can be set in the config with 'glab config set remote_alias origin'

VISUAL, EDITOR (in order of precedence): the editor tool to use for authoring text.
Can be set in the config with 'glab config set editor vim'

BROWSER: the web browser to use for opening links.
Can be set in the config with 'glab config set browser mybrowser'

GLAMOUR_STYLE: environment variable to set your desired markdown renderer style
Available options are (dark|light|notty) or set a custom style
https://github.com/charmbracelet/glamour#styles

NO_COLOR: set to any value to avoid printing ANSI escape sequences for color output. 

Issues

If you have an issue: report it on the issue tracker

Contributing

Feel like contributing? That's awesome! We have a contributing guide and Code of conduct to help guide you

Support glab πŸ’–

By donating $5 or more you can support the ongoing development of this project. We'll appreciate some support. Thank you to all our supporters! πŸ™ [Contribute]

Individuals

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! πŸ™ [Become a backer]

License

Copyright Β© Clement Sam

glab is open-sourced software licensed under the MIT license.

Directories ΒΆ

Path Synopsis
cmd
api
ci
ci/legacyci
This package contains the old `glab pipeline ci` command which has been deprecated in favour of the `glab ci` command.
This package contains the old `glab pipeline ci` command which has been deprecated in favour of the `glab ci` command.
cmdutils
Forked from https://github.com/cli/cli/blob/929e082c13909044e2585af292ae952c9ca6f25c/pkg/cmd/factory/default.go
Forked from https://github.com/cli/cli/blob/929e082c13909044e2585af292ae952c9ca6f25c/pkg/cmd/factory/default.go
help
forked from https://github.com/cli/cli/blob/929e082c13909044e2585af292ae952c9ca6f25c/pkg/text/indent.go
forked from https://github.com/cli/cli/blob/929e082c13909044e2585af292ae952c9ca6f25c/pkg/text/indent.go
mr
mr/diff
adapted from https://github.com/cli/cli/blob/trunk/pkg/cmd/pr/diff/diff.go
adapted from https://github.com/cli/cli/blob/trunk/pkg/cmd/pr/diff/diff.go
internal
git
run
pkg
api
This is a silly wrapper for go-gitlab but helps maintain consistency
This is a silly wrapper for go-gitlab but helps maintain consistency
surveyext
this is a wrapper for https://github.com/AlecAivazis/survey package but with additional extensions and customizations for glab adapted from https://github.com/cli/cli/blob/trunk/pkg/surveyext/editor.go
this is a wrapper for https://github.com/AlecAivazis/survey package but with additional extensions and customizations for glab adapted from https://github.com/cli/cli/blob/trunk/pkg/surveyext/editor.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL