gitig
Generate .gitignore
files from the command-line
gitig
writes its output to stdout. Redirect the results to wherever makes sense for you, for example:
Installation
With cargo
gitig
has an implementation in Rust (and an implementation in Python) and can be installed via cargo
:
With pipx
gitig
is intended to be used as an end-user command-line application (i.e. not as a package's dependency). The easiest way to get started is with pipx
:
With pip
gitig
can also be installed via vanilla pip (or poetry, etc.):
Usage
$ gi -h
usage: gi [-h] [-v] [--completion {bash,fish}] [--no-pager]
[template [template ...]]
positional arguments:
template Template(s) to include in the generated .gitignore
file. If no templates are specified, display a list of
all available templates.
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
--completion {bash,fish}
Generate a completion file for the selected shell.
--no-pager Write template list to stdout. By default, this
program attempts to paginate the list of available
templates for easier reading.
Examples
-
List all available gitignore templates (using a pager if one is available):
-
Generate a gitignore file for Python and Jupyter:
Enable tab completion for Bash or Fish
gitig
supports generating completion scripts for Bash and Fish. Below are commands to generate completion scripts for the various shells
For Bash, you will likely have to
source
(.
) the generated tab completion script for it to take effect.To enable tab completion on startup you can source the completion generated completion script in your
.bashrc
or.bash_profile
.
Bash
Bash (Homebrew)
Fish
gi --completion fish > ~/.config/fish/completions/gi.fish
Fish (Homebrew)
gi --completion fish > (brew --prefix)/share/fish/vendor_completions.d/gi.fish
API
CLI
Autocompletion
Rust API
; // same as `gi`
create; // same as `gi python jupyter`
bash_completion; // same as `gi --completion bash`
fish_completion; // same as `gi --completion fish`
VERSION;
list_templates
Python API
# same as `gi`
# same as `gi python jupyter`
# same as `gi --completion bash`
# same as `gi --completion fish`
Contributing
Rust
- Fork the repo
- Run
cargo build
- Run
pre-commit install
- Add your changes (adding/updating tests is always nice too)
- Commit your changes + push to your fork
- Open a PR
Python
- Have or install a recent version of
poetry
(version >= 1.1) - Fork the repo
- Setup a virtual environment (however you prefer)
- Run
poetry install
- Run
pre-commit install
- Add your changes (adding/updating tests is always nice too)
- Commit your changes + push to your fork
- Open a PR