mergereq

CLI for Gitlab merge requests & more

Install

```sh cargo install mergereq

or

npm i -g mergereq-bin ```

Setup

First of all, to request data requires authentication you need to save you Gitlab private token. ( Find it here ). sh mergereq config save-token "$YOUR_PRIVATE_TOKEN" Token will be saved (by default) at system config dir, e.g. for Linux it would be ~/.config/.mergereq-config. Path to global config can be overwritten with --global-config option.

Also create the local configuration file for mergereq in directory when you want to use it (default name is ./.mergereqrc.toml). Path can be overwritten with --local-config option. ```toml

Gitlab API endpoint

repo_url = "https://example.com"

The ID or path of the project

defaultproject = "web/mybest_project" ```

You may overwrite all this parameters when run command with --private-token, --repo-url and -P, --project options.

Docs

All documentation available in mergereq CLI with --help or -h flag. Some examples here:

Aboute merge request creating

Some options has default values

| Option | Desc | Default | | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------- | | -S, --src <source-branch> | The source branch | Current git branch | | -T, --trg <target-branch> | The target branch | Project default branch | | -I, --title <title> | The target branch | Message of last commit in source branch | | --assignee-id <assignee-id> | Assignee user ID | Unassigned | | -A, --assignee-name <assignee-name> | Assignee user name. mergereq will fetch all active users, then search one with specified name, if not available throws error | Unassigned | | -R, --remove-source-branch | Flag indicating if a merge request should remove the source branch when merging | false | | -Q, --squash | Squash commits into a single commit when merging | false |

Example

```sh 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/mybestproject/merge_requests/23

Status: canbemerged

```

Create merge request

``` 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 user ID -A, --assignee-name Assignee user name -D, --desc Description of MR. Limited to 1 000 000 characters --global-config Path of global config file. e.g. for Linux it would be ~/.config/.mergereq-config --local-config Path of local config file. Default is .mergereqrc.toml in the current directory. --private-token Sets the Gitlab private token for requests -P, --project The ID or path of the project owned by the authenticated user --repo-url URL of your Gitlab domain -S, --src The source branch -T, --trg The target branch -I, --title Title of MR</p> <p>```</p> <h4>List</h4> <p>``` mergereq-ls Print info about everything</p> <p>USAGE: mergereq ls [OPTIONS] <SUBCOMMAND></p> <p>FLAGS: -h, --help Prints help information</p> <p>OPTIONS: --global-config <global-config> Path of global config file. e.g. for Linux it would be <code>~/.config/.mergereq -config</code> --local-config <local-config> Path of local config file. Default is <code>.mergereqrc.toml</code> 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</p> <p>SUBCOMMANDS: branches List branches mr List merge requests projects List projects users List users ```</p> <h4>List merge requests</h4> <p>``` mergereq-ls-mr List merge requests</p> <p>USAGE: mergereq ls mr [OPTIONS]</p> <p>FLAGS: -h, --help Prints help information</p> <p>OPTIONS: -A, --assignee-id <assignee-id> Returns merge requests assigned to the given user id. None returns unassigned merge requests. Any returns merge requests with an assignee. -U, --author-id <author-id> Returns merge requests created by the given user id. Combine with scope=all or scope=assigned<em>to</em>me --global-config <global-config> Path of global config file. e.g. for Linux it would be <code>~/.config/.mergereq -config</code> --local-config <local-config> Path of local config file. Default is <code>.mergereqrc.toml</code> 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 -C, --scope, <scope> Return merge requests for the given scope: created<em>by</em>me, assigned<em>to</em>me or all. Defaults to created<em>by</em>me [values: created<em>by</em>me, assigned<em>to</em>me, all] -S, --search <search> Search merge requests against their title and description -R, --source-branch <source-branch> Return merge requests with the given source branch -E, --state, <state> Return all merge requests or just those that are opened, closed, locked, or merged [values: opened, closed, locked, merged] -T, --target-branch <target-branch> Return merge requests with the given target branch ```</p> <h5>Enjoy using!</h5> <h3>License</h3> <p>This module is <a href="./LICENSE">MIT licensed</a>.</p> </body></html>