gitlab-tool-cli
v0.0.2
Published
gitlab-tool-cli ==================
Downloads
1
Readme
gitlab-tool-cli
gitlab-tool-cli is a command line utility created in JavaScript. Inspired from hub. It tries to provide commands which makes working with gitlab from the command line easier.
Creating a merge request with gitlab-tool-cli is as simple as
$ lab merge-request
Installation
Install it using npm
$ npm install gitlab-tool-cli -g
Usage
$ lab command [options]
To get a list of available commands
$ lab --help
Commands available
browse Open current branch page in gitlab
compare [options] Open compare page between two branches
merge-request [options] Create merge request on gitlab
merge-requests [options] Opens merge request page for the repo.
Check help of each command like following
$ lab merge-request --help
Running example
$ lab merge-request -b feature/feature-name -t develop
Above will create merge request for merging feature/feature-name in develop.
Options for create-merge-request
-h, --help output usage information
-b, --base [optional] Base branch name
-t, --target [optional] Target branch name
-m, --message [optional] Title of the merge request
-l, --labels [optional] Comma separated list of labels to assign while creating request
-e, --edit [optional] If supplied opens edit page of merge request. Opens merge request page otherwise
-v, --verbose [optional] Detailed logging emitted on console for debug purpose
-a, --assignee [optional] If supplied, username will be searched in gitlab and created merge request will be assigned to th user.
Configurations
gitlab-tool-cli captures configurations needed for itself on the first run. Just run the command you want to run and it will capture the information needed.
You can also set the configurations yourself as git config (project specific) or environment variables (global).
git config
Setting git config allows you to provide separate configurations for each gitlab repository.
$ git config --add gitlab.url "https://gitlab.yourcompany.com"
$ git config --add gitlab.token "abcdefghijskl-1230"
Find your gitlab token at https://gitlab.yourcompany.com/profile/account
Environment variables
Setting environment variables allows you to provide global configurations which will be used for all your gitlab repositories when using gitlab-tool-cli.
GITLAB_URL=https://gitlab.yourcompany.com
GITLAB_TOKEN=abcdefghijskl-1230
Find your gitlab token at https://gitlab.yourcompany.com/profile/account
Features supported
- Base branch is optional. If base branch is not provided. Current branch is used as base branch.
- Target branch is optional. If target branch is not provided, default branch of the repo in gitlab will be used.
- Created merge request page will be opened automatically after successful creation.
- If title is not supported with -m option value. It will be taken from in place editor opened. First line is taken as title.
- In place editor opened contains latest commit message.
- In the editor opened third line onwards takes as description.
- Comma separated list of labels can be provided with its option.
- Supports forks. If base branch and target branch are on different remotes. Merge request will be created between forks.
- Supports setting assignee for merge request.