Changes: - Removed unsupported flag '--state opened' from glissue-list' - Updated glreleases-create to use --name instead of -t - Updated glrepo-list to remove unsupported --membership flag
3 KiB
glab plugin
This plugin adds support for the GitLab CLI (glab), a tool to interact with GitLab from the terminal.
Features
- Shell completion: enables
zshcompletions forglabautomatically if it is installed. - Environment setup: loads
GITLAB_HOSTandGITLAB_TOKENfrom~/.netrcif they are not already set. - Aliases: provides convenient shortcuts for common GitLab CLI commands.
- Helper functions: adds extra functions for common GitLab workflows, including merge requests, issues, CI/CD pipelines, repositories, and releases.
Aliases
| Alias | Command | Description |
|---|---|---|
gl |
glab |
Shortcut for glab |
glmr |
glab mr |
Manage merge requests |
glissue |
glab issue |
Manage issues |
glrepo |
glab repo |
Manage repositories |
glci |
glab ci |
Manage CI pipelines |
glprj |
glab project |
Manage projects |
glrelease |
glab release |
Manage releases |
Helper functions
Merge Requests
-
glmr-open [<MR>]
Opens a merge request in the browser. If<MR>is not specified, opens the current branch MR. -
glmr-checkout <MR>
Checks out the merge request branch locally. -
glmr-merge <MR>
Merges a merge request and optionally removes the source branch. -
glmr-list [<args>]
Lists merge requests assigned to you. Additionalglab mr listarguments can be passed.
Issues
-
glissue-new [<title>]
Creates a new issue. If a title is provided, it is used; otherwise an interactive prompt is opened. -
glissue-close <issue>
Closes the specified issue. -
glissue-list [<args>]
Lists open issues assigned to you. Additionalglab issue listarguments can be passed.
CI/CD
-
glci-status [<args>]
Opens the current CI pipeline status in the browser. -
glci-retry <pipeline>
Retries the specified pipeline. -
glci-latest
Shows the latest pipeline.
Repositories
-
glrepo-clone <project>
Clones a repository. -
glrepo-list [<args>]
Lists all repositories you are a member of. -
glrepo-open <project>
Opens a repository in the browser. -
glrepo-starred [<args>]
Lists your starred repositories.
Releases
glrelease-create "<title>" "<tag>"
Creates a new release with the given title and tag.
Search
glsearch <keyword>
Searches for merge requests and issues matching the keyword.
Environment variables
The plugin attempts to set the following variables if they are not already defined:
GITLAB_HOST— taken from the firstmachineentry in~/.netrc.GITLAB_TOKEN— the correspondingpasswordfrom~/.netrc.
Usage
- Install
glab. - Enable the plugin in your
.zshrc:
plugins=(git glab)