#gitignore #github #git #command-line-tool #cli

bin+lib clignore

Simple CLI tool to find .gitignore files based on your language or framework

3 releases

0.1.2 Apr 30, 2020
0.1.1 Apr 30, 2020
0.1.0 Apr 30, 2020

#1515 in Development tools

GPL-3.0-only

67KB
661 lines

CLIgnore

clignorance is bliss

CLIgnore is a simple command-line tool to find .gitignore files based on your language or framework. It uses the GitHub API to search for template files from GitHub's official repo, so you can automagically download and use them in your projects in no-time.

Rationale

.gitignore files are annoying and I hate them. While many IDEs and version control tools generate .gitignore files for you, that's not always the case. So instead of constantly Googling for the gitignore repo, finding the right template, copying the template, and pasting it in my project like a schmuck... I made a tool that does it for me (and you!)

Usage

Find

Usage Screenshot

Use clignore find to search based on your langauge or framework, and select the file you need. If CLIgnore finds only 1 file matching your search, it'll be automatically download.

Everything else

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <token>    Sets the OAuth2 token for authenticated requests [env: TOKEN=]

SUBCOMMANDS:
    authenticated    Checks the GitHub API to see if you have an authorization token present
    find             Finds files by name
    help             Prints this message or the help of the given subcommand(s)
    list             Lists all gitignore template files

Setting an OAuth2 token

The GitHub API rate-limits users to 60 requests in 1 hour. If, for some reason, you need more than this, CLIgnore allows you to set an OAuth2 token via an enviornment variable:

TOKEN=<your super-secret token here> clignore find python

Authenticated requests can make up to 5000 requests per hour. More on that here.

Installation

CLIgnore is written in Rust. The recommended way to install Rust is from the official download page.

Once Rust is installed, use cargo install:

cargo install clignore

Cargo will build the CLIgnore binary and place it in $HOME/.cargo. You'll then (hopefully) be able to use clignore.

Roadmap

  • Some kind of CI/CD would be nice
  • Along that same line, it would be helpful to have pre-built binaries somewhere
  • Haven't done any testing on Windows or Mac. Should probably do that.
  • Need to determine the minimum version of rustc necessary to build (add to readme)
  • The error handling is pretty lazy. I'm just doing a bunch of unwraps in main, so while errors are displayed to the user, they're not very pretty.
  • All the source files are hanging out at the root src/ because I got confused by the module system. Ideally I'd like to figure this out and move things into folders.

Dependencies

~5–10MB
~189K SLoC