Skip to main content

gitignore-cli

PyPI - Version

gitignore-cli is a command-line tool that allows you to easily generate .gitignore files by selecting from pre-defined templates. It leverages the collection of .gitignore templates provided by GitHub and lets you combine multiple templates into a single file.

Features

  • Generate .gitignore files from predefined templates.
  • Combine multiple templates into a single .gitignore file.
  • List available templates.
  • Autocomplete support for templates (Bash and Zsh).
  • Custom header added to the generated .gitignore files.

Installation

To install gitignore-cli-py, we recommend using pipx to ensure the command is globally accessible and isolated from other Python packages.

Install pipx (if not already installed)

pipx is a tool to install and run Python applications in isolated environments. First, install pipx if you haven't already:

sudo apt install pipx

Install gitignore-cli-py with pipx

Now, use pipx to install gitignore-cli-py globally:

pipx install gitignore-cli-py

This command will make the gitignore-cli command available globally in your terminal. After installing, ensure that pipx is added to your PATH by running:

pipx ensurepath

Verifying the Installation

After installation, you can verify that gitignore-cli is working by running:

gitignore-cli --help

This should display the help message for gitignore-cli.

Autocomplete setup

The CLI also supports autocompletion for templates when using Bash or Zsh. To enable autocompletion, follow these steps:

For Bash:

Run the following command to generate the autocomplete script and add the following line to your .bashrc file:

_GITIGNORE_CLI_COMPLETE=bash_source gitignore-cli > ~/.gitignore-cli-complete.sh
echo "source ~/.gitignore-cli-complete.sh" >> ~/.bashrc
source ~/.bashrc

For Zsh:

Run the following command to generate the autocomplete script and add the following line to your .zshrc file:

_GITIGNORE_CLI_COMPLETE=zsh_source gitignore-cli > ~/.gitignore-cli-complete.sh
echo "source ~/.gitignore-cli-complete.sh" >> ~/.zshrc
source ~/.zshrc

Usage

1. Generate a .gitignore file

To generate a .gitignore file with one or more templates, use the following command:

gitignore-cli generate <template1> <template2> --output <output_file>

For example, to generate a .gitignore file that includes the templates for Python and Node.js, run:

gitignore-cli generate Python Node --output .gitignore

This will create a .gitignore file combining the templates for Python and Node.js.

List available templates

To list all the available templates:

gitignore-cli list-templates

This will output a list of all templates, organized in columns for easier readability.

4. Example

# Generate a .gitignore file for Python and Node.js 
gitignore-cli generate Python Node --output .gitignore

Custom Header

Each generated .gitignore file contains a custom header indicating that the file was generated by gitignore-cli along with the date and a reference to the repository. Example header:

# ====================================== 
# .gitignore file generated by gitignore-cli 
# Generated on: 2024-10-07 01:45:23 
# For more information, visit: https://github.com/ninjapythonbrasil/gitignore-cli 
# ======================================

Contributing

We welcome contributions! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add some feature').
  5. Push to the branch (git push origin feature-branch).
  6. Open a Pull Request.

Please make sure to update tests as appropriate.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

If you have any questions or suggestions, feel free to open an issue or reach out!

Metadata

Release files for gitignore-cli-py 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitignore-cli-py 0.1.3
File Size Uploaded
gitignore-cli-py-0.1.3.tar.gz 122.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitignore-cli-py 0.1.3
File Interpreter ABI Platform
gitignore_cli_py-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 383.5 kB

Release files / gitignore-cli-py-0.1.3.tar.gz

Download URL gitignore-cli-py-0.1.3.tar.gz
Size 122.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cb9367c11bae4cbf231167639bacad499968012780fbbac9e56bb9fc1af17600
BLAKE2b-256 checksum
How to use checksums
71412c7b17e6118390affb2dcd45ec4d898a57253eb584bc3057175d5a48b866
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release files / gitignore_cli_py-0.1.3-py3-none-any.whl

Download URL gitignore_cli_py-0.1.3-py3-none-any.whl
Size 261.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68dfc4600aec9bb0d9a29d98604158af18c3f9ad11374ab405fd108681aeff0e
BLAKE2b-256 checksum
How to use checksums
80da38f08ab33580eb50b6be58597bfff5756e9bf664100919c0c032401d1857
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page