Skip to content

andrew-s28/easyignore

Repository files navigation

easyignore

License: MIT GitHub Actions Workflow Status PyPI Release Ruff

A simple CLI tool to easily create .gitignore and .prettierignore files for over 500 languages and frameworks.

Features

  • 🚀 Generate .gitignore and .prettierignore files with a single command
  • 📚 500+ languages and frameworks via gitignore.io
  • 📋 Shell auto-completion support

Installation

Using uv (recommended):

uv tool install easyignore

Using pipx:

pipx install easyignore

Alternatively, run without an install using uvx (no auto-complete):

uvx easyignore

Usage

Basic Examples

Create a .gitignore file for Python:

easyignore python

Create a .gitignore file for multiple languages separated by a space:

easyignore python node react

Print the ignore file content to stdout without saving to a file:

easyignore python --print

List all available languages and frameworks:

easyignore --list

Create a file with a different name (e.g., .prettierignore):

easyignore react --file .prettierignore

Controlling Output

Specify a file and/or a directory with:

easyignore python --file .prettierignore --directory .

If the directory does not exist, it will be created.

If the file already exists, either append or overwrite it:

easyignore java --append
easyignore go --overwrite

If you don't select an option and the file exists, you will be prompted to decide.

Instead of outputting to a file, you can print to stdout enabling piping to wherever you like:

easyignore python --print

Printing to stdout will disable printing to a file, regardless of what other options are entered.

Shell Completion

One of the main advantages of easyignore is shell auto-completion, supported for bash, zsh, fish, and powershell, powered by typer auto-complete.

Automatically install the required scripts to your shell profile with:

easyignore --install-completion

Alternatively, you can print the shell completion script:

easyignore --show-completion

[!NOTE] Auto-complete will only work when easyignore is called directly from the command line - uvx doesn't support autocomplete.

Options

Option Description
-d, --directory DIRECTORY Directory for ignore file. (default: current directory)
-f, --file TEXT File name for ignore file. (default: .gitignore)
-a, --append Append to existing ignore file.
-o, --overwrite Overwrite existing ignore file.
-p, --print Print ignore file to stdout instead of saving to file.
-l, --list List available languages/frameworks for ignore file.
-i, --install-completion Install shell completion for easyignore.
-s, --show-completion Show shell completion for easyignore.
-h, --help Show help message and exit.

How It Works

easyignore currently uses the gitignore.io API to fetch the latest ignore patterns for your selected languages and frameworks. However, easyignore is designed not to be locked into this decision - the specific APIs used to retrieve .gitignore may be expanded or swapped with no user functionality changes. This is particularly relevant since the gitignore.io template repository was recently archived and alternatives such as donotcommit may be preferred in the future.

The command line interface for easyignore is built with typer, with a modified shell completion solution that uses shellingham to identify the shell. The templates are retrieved using requests and printed to the console with Rich.

License

MIT

About

A command line tool to generate ignore files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages