5 个版本
0.2.2 | 2019年12月27日 |
---|---|
0.2.1 | 2019年12月13日 |
0.2.0 | 2019年12月10日 |
0.1.9 | 2019年11月28日 |
0.1.8 | 2019年11月28日 |
#1104 in 开发工具
63KB
1.5K SLoC
mergereq
Gitlab 合并请求及更多功能的 CLI 工具
安装
cargo install mergereq
# or
npm i -g mergereq-bin
设置
首先,要请求数据需要认证,您需要保存您的 Gitlab 私有令牌。(在 这里 查找)。
mergereq config save-token "$YOUR_PRIVATE_TOKEN"
令牌将被保存在(默认情况下)系统配置目录中,例如,对于 Linux,它将是 ~/.config/.mergereq-config
。全局配置的路径可以通过 --global-config
选项覆盖。
同时,在您想使用它的目录中创建 mergereq 的本地配置文件(默认名称为 ./.mergereqrc.toml
)。路径可以通过 --local-config
选项覆盖。
# Gitlab API endpoint
repo_url = "https://example.com"
# The ID or path of the project
default_project = "web/my_best_project"
您可以在运行命令时通过 --private-token
、--repo-url
和 -P, --project
选项来覆盖所有这些参数。
文档
可用的子命令
config save-token
- 将令牌存储到配置文件config show-token
- 如果存在,则显示 GitLab 私有令牌config forget-token
- 删除包含私有令牌的全局配置文件create mr
- 创建合并请求ls branches
- 显示分支列表ls mr
- 显示合并请求列表ls projects
- 显示项目列表ls users
- 显示用户列表
关于创建合并请求
一些选项具有默认值
选项 | 描述 | 默认值 |
---|---|---|
-S, --src<源-branch> |
源分支 | 当前 git 分支 |
-T, --trg<目标-branch> |
目标分支 | 项目默认分支 |
-I, --title<title> |
目标分支 | 源分支最后提交的消息 |
--assignee-id<assignee-id> |
分配者用户 ID | 未分配 |
-A, --assignee-name<assignee-name> |
分配者用户名。 mergereq 将检索所有活跃用户,然后根据指定的名称搜索,如果不可用则抛出错误 |
未分配 |
-R, --remove-源-branch |
标志,指示合并请求在合并时是否应删除源分支 | false |
-Q, --squash |
合并时将提交压缩成单个提交 | false |
示例
mergereq create mr -A team.lead
# You creating merge requests with this parameters:
# Source branch: — feature/move_btn
# Target branch: — develop
# Title branch: — Move button by 1px to the right
# Assignee: — team.lead (ID: 2)
# Do you want to continue? [Y/n]
#
# Your merge request is created. You can see it here:
# https://example.com/web/my_best_project/merge_requests/23
# Status: can_be_merged
创建合并请求
mergereq-create-mr
Creates merge request
USAGE:
mergereq create mr [FLAGS] [OPTIONS]
FLAGS:
-h, --help Prints help information
-R, --remove-source-branch Flag indicating if a merge request should remove the source branch when merging
-Q, --squash Squash commits into a single commit when merging
OPTIONS:
--assignee-id <assignee-id> Assignee user ID
-A, --assignee-name <assignee-name> Assignee user name
-D, --desc <description> Description of MR. Limited to 1 000 000 characters
--global-config <global-config> Path of global config file. e.g. for Linux it would be `~/.config/.mergereq-config`
--local-config <local-config> Path of local config file. Default is `.mergereqrc.toml` in the current
directory.
--private-token <private-token> Sets the Gitlab private token for requests
-P, --project <project> The ID or path of the project owned by the authenticated user
--repo-url <repo-url> URL of your Gitlab domain
-S, --src <source-branch> The source branch
-T, --trg <target-branch> The target branch
-I, --title <title> Title of MR
所有文档在mergereq CLI中可用,使用--help
或-h
标志。
享受使用吧!
许可证
此模块遵循MIT许可证。
依赖项
~22MB
~450K SLoC