Skip to main content

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 .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

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:

  1. Run the following command to generate the autocomplete script:
_GITIGNORE_CLI_COMPLETE=bash_source gitignore-cli > ~/.gitignore-cli-complete.sh
  1. Add the following line to your .bashrc file:
source ~/.gitignore-cli-complete.sh
  1. Reload your Bash configuration:
source ~/.bashrc

For Zsh:

  1. Run the following command to generate the autocomplete script:
_GITIGNORE_CLI_COMPLETE=zsh_source gitignore-cli > ~/.gitignore-cli-complete.sh
  1. Add the following line to your .zshrc file:
source ~/.gitignore-cli-complete.sh
  1. 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:

  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!

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

gitignore_cli_py-0.1.1.tar.gz (122.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitignore_cli_py-0.1.1-py3-none-any.whl (261.0 kB view details)

Uploaded Python 3

File details

Details for the file gitignore_cli_py-0.1.1.tar.gz.

File metadata

  • Download URL: gitignore_cli_py-0.1.1.tar.gz
  • Upload date:
  • Size: 122.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for gitignore_cli_py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bcc95b55b0fd9e4951163358641402153da578b29c599a2f87527b7000fcf185
MD5 e123bab1931dc39bf1690fefc27bdff6
BLAKE2b-256 f0370cb37a9204d6c63f1f88551f96f4febe90d3c450ddc0c4b63918720b7d3f

See more details on using hashes here.

File details

Details for the file gitignore_cli_py-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gitignore_cli_py-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c0d673130c3a0123b75aff8fd98663035af2843cdb977a00f2eba4616ea33fe
MD5 b34b8b4028207da5ec877820465958b3
BLAKE2b-256 439a685935b376302d98c8332b302d1685dea3303256980646f6ea760c313de5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page