Helpful tools for your GitLab projects (GitHub projects will be supported later).
- GitLab access token with selected
apiscope - Python >= 3.11.7
requirements-dev.txt: contains linters, formatters and other libraries needed for developmentrequirements-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 valuesSource 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 usageNote
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.
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
To build the project, use the make:
make buildNew folders with files will be generated (build/, dist/), of
which dist/ will contain the binary.
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
Tip
The above output can also be piped through less and similar.
