Skip to content

Helpful script with git tools to help with development on your GitLab (or GitHub) projects

License

Notifications You must be signed in to change notification settings

AnaZ083c/git-tools

Repository files navigation

git-tools

Helpful tools for your GitLab projects (GitHub projects will be supported later).

Development and installing

Requirements

  • GitLab access token with selected api scope
  • Python >= 3.11.7
  • requirements-dev.txt: contains linters, formatters and other libraries needed for development
  • requirements-build.txt: contains libraries for building a binary
# Create Python virtual environtment
python -m venv .venv
pip install -r requirements-dev.txt \
            -r requirements-build.txt
source .venv/bin/activate

# Create a git config where you store your access tokens
# from the provided .tokens.example
mkdir -p ~/.config/git/
cp .tokens.example ~/.config/git/.tokens
# Modify your .tokens file with your own values

Code

Source files can be found in src of which main.py is where the base of git-tools is located, while tools is where each of those tools and other logic is.

To run without building, you must run the src/main.py:

PYTHONPATH="./" python main.py  # help will be printed out for further usage

Note

To be able to test the show-issue tool, you must run the above from a git project folder, in which case, you might also have to adjust the PYTHONPATH to point to the root/path/to/this/repo/ folder of this project.

Makefile

For easier development, you may also use the provided Makefile with its make targets:

❯ make
help                           Prints help for targets with comments
build                          Build git-tools binary
format                         Format using ruff
lint                           Lint using mypy and ruff
sanity                         Sanity check before formatting
test                           Run pytest to test the code

Building git-tools

To build the project, use the make:

make build

New folders with files will be generated (build/, dist/), of which dist/ will contain the binary.

Installing for global use

After building the project as shown above, add the following to your prefered shell config (~/.bashrc, ~/.zshrc, etc.):

# adjust the path below to point to the ./dist folder here
export PATH=$PATH:"/path/to/git-tools/dist"

Then test the global use:

$ git-tools --help
usage: git-tools [--help|options]

Useful tools to use with your git project

positional arguments:
  {show-issue}  --help
    show-issue  Show git issue description in your terminal

options:
  -h, --help    show this help message and exit

Example of a rendered issue description

git-tools example usage

Tip

The above output can also be piped through less and similar.

About

Helpful script with git tools to help with development on your GitLab (or GitHub) projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •