Skip to content

Automate gathering your work on gitlab.com to save time.

License

Notifications You must be signed in to change notification settings

mjburtenshaw/macglab

Repository files navigation

macglab

Automate gathering your work on gitlab.com to save time.

Static Badge

📖 Table of Contents

Installation

Requirements

  1. Verify you have installed Go: go version
  2. Verify you have GOPATH in your shell environment: echo "${GOPATH}"
  3. Verify you have added Go binaries to your PATH: export PATH="${GOPATH}/bin:${PATH}"

🐚 Tip: it might be worth it to add the last command to your shell config file.


  1. Clone this repository, move into it, install the binary, and run the init command:
git clone https://github.com/mjburtenshaw/macglab.git
cd macglab
go install
macglab init
  1. Define values in the config file at $HOME/.macglab/. See configuration for details.

  2. Re-source your shell or open a new terminal to run the macglab list command!

Updating

To update to the latest version, pull the latest from the repository and reinstall the binary:

git checkout main
git pull
go install

Usage

Commands

Flags

These flags apply to the main command, macglab:

  • -v, --version: Print the version to the terminal.

These flags apply to every command:

  • -h, --help: Print help the terminal.

init

Initializes macglab.

macglab init

init does the following:

  1. Checks if there's a previous installation. Exits if so.
  2. Demands a home directory for this program on your machine.
  3. Adds required environment variables to your shell config file.
  4. Makes a new config file.

The config directory is created at $HOME/.macglab.

The config file is located at $HOME/.macglab/config.yml

We support the following shells:

  • zsh.

list

Prints GitLab Merge Request (MRs) authors and URLs to the terminal.

macglab list [OPTIONS...]

list fetches MRs meeting ALL the following criteria:

list then excludes MRs meeting the following criteria:

  • Approved by you.
  • Mergeable MRs where you are NOT the author.
Flags
  • -a, --approved: Include MRs you approved.
  • -b, --browser: Open MRs in the browser.
  • -c, --count: Print the result count to the terminal.
  • -d, --draft: Include draft MRs.
  • -g, --group: ONLY include MRs where the author is listed in the provided users (see -u, --users) or the configured usernames.
  • -i <string>, --group-id=<string>: Override the configured group ID with the given string.
  • -m <number>, --me <number>: Override the configured me user ID with the given number.
  • -p, --projects: ONLY include MRs where the author is listed in ANY of the configured projects; but it only returns MRs for projects the author is listed under.
  • -r, --ready: Include mergeable MRs.
  • -t <string>, --access-token <string>: Override the configured access token.
  • -u <string>, --users=<string>: Override configured usernames and ONLY filter on usernames you provided. Accepts a CSV of usernames.

👯‍♀️ Note: group and projects are not mutually exclusive. If neither are provided, the program will run as if both are provided.

Configuration

See the sample config for a full example.

access_token

A GitLab personal access tokens.

group_id

A GitLab group ID.

me

Your GitLab user ID (though it doesn't have to be yours). It's used for the following:

  • Filter MRs based on approval.
  • Include MRs where the given user ID is a reviewer.

projects

A map of GitLab project IDs having a list associated usernames you wish to follow. For example:

projects:
    all: # usernames listed under the "all" entry will apply to every project.
        - username1
    123: # projectA
        - username2
        - username3
    456: # projectB
        - username3
        - username4
    789: # projectC
        # if left blank, this will inherit from `all`.
    101112:
        # projectD
        - username4

usernames

A list of GitLab usernames in the group you wish to follow.

Contributing

See CONTRIBUING

About

Automate gathering your work on gitlab.com to save time.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages