A command-line tool to generate .gitignore files from predefined templates
Project description
gitignore-cli
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
.gitignorefiles from predefined templates. - Combine multiple templates into a single
.gitignorefile. - List available templates.
- Autocomplete support for templates (Bash and Zsh).
- Custom header added to the generated
.gitignorefiles.
Installation
You can install the gitignore-cli using pip:
pip install gitignore-cli
Make sure you have Python 3.7+ installed.
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.
2. 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.
3. 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:
_GITIGNORE_CLI_COMPLETE=bash_source gitignore-cli > ~/.gitignore-cli-complete.sh
- Add the following line to your
.bashrcfile:
source ~/.gitignore-cli-complete.sh
- Reload your Bash configuration:
source ~/.bashrc
For Zsh:
- Run the following command to generate the autocomplete script:
_GITIGNORE_CLI_COMPLETE=zsh_source gitignore-cli > ~/.gitignore-cli-complete.sh
- Add the following line to your
.zshrcfile:
source ~/.gitignore-cli-complete.sh
- Reload your Zsh configuration:
source ~/.zshrc
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:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature-branch). - 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!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitignore_cli_py-0.1.0.tar.gz.
File metadata
- Download URL: gitignore_cli_py-0.1.0.tar.gz
- Upload date:
- Size: 121.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3475911b6f2d16141239f6a49e8e817c7a3b0a46076d66c8046fbe3fefb49b71
|
|
| MD5 |
b48d1c1adc7879482910bcd19c106445
|
|
| BLAKE2b-256 |
728222fd2235cc2958b8195f9ea2a7926fb10b321c29060032c38b74b2cedfeb
|
File details
Details for the file gitignore_cli_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gitignore_cli_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 261.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd7cf9cb1489614ca3fccef601491aa3bd9d6f57693f922d33462eca97b8593e
|
|
| MD5 |
213ceefeaa55773543bfb983b852cfb5
|
|
| BLAKE2b-256 |
ff72ed71f166dac7bd6e478a163b3d32edb9e94c00698bd5ea9ef86d0af223aa
|