18 stable releases
2.5.1 | Oct 18, 2024 |
---|---|
2.4.0 | Sep 20, 2024 |
2.3.3 | Oct 28, 2023 |
2.3.2 | May 11, 2022 |
1.0.1 | Oct 14, 2021 |
#87 in Development tools
340 downloads per month
Used in 6 crates
(3 directly)
265KB
2K
SLoC
Gitignores
GitHub’s collection of gitignores, embedded, automatically updated.
- API documentation.
- Public Domain via CC0-1.0 (same as source data).
- MSRV: 1.37.0 (increases are breaking changes)
- Doesn't require std.
- No dependencies.
- Works offline.
Quick start
[dependencies]
gitignores = "1.0.0"
dbg!(gitignores::Root::Rust);
API
Each gitignore is available as a variant of one of three enums:
(
gitignores::Root::Rust,
gitignores::Global::Emacs,
gitignores::Community::Racket,
)
The enums implement Display
/ .to_string()
, which will return the contents of the gitignore
(only when the std
feature is enabled):
println!("{}", gitignores::Root::Rust);
gitignores::Global::Emacs.to_string();
The enums also implement a GitIgnore
trait:
trait GitIgnore {
/// The contents of the gitignore
///
/// Returns an empty string if the `no-contents` feature is enabled.
fn contents(self) -> &'static str;
/// The file name of the gitignore
fn file_name(self) -> &'static str;
/// The full path of the gitignore relative to repo root
fn file_path(self) -> &'static str;
/// The list of all included gitignores
fn list() -> Vec<&'static str>;
}
Finally, there is a constant with the git reference of the commit the crate was built from:
dbg!(gitignores::GIT_COMMIT_REF);
Features
By default all gitignores are included, but you can customise this as granularily as you wish. To get started with selecting your custom set, first disable the default features:
[dependencies.gitignores]
default-features = false
features = []
Collections
Feature name | Path in gitignore repo | Path in crate |
---|---|---|
root |
/*.gitignore |
Root:: |
global |
/Global/**/*.gitignore |
Global:: |
community |
/community/**/*.gitignore |
Community:: |
Individual gitignores
Each gitignore can be enabled with the <collection>-<name>
feature. Gitignores in subfolders have
the folder name prepended to the name, like <collection>-<folder>-<name>
. All are lowercased.
Other
no-contents
: omit the embedded file contents, leaving only the metadata.std
: implement theDisplay
trait on the enums.
Examples
All globals and only Rust root
[dependencies.gitignores]
default-features = false
features = ["global", "root-rust"]
Some specific gitignores
[dependencies.gitignores]
default-features = false
features = ["community-racket", "global-emacs", "root-commonlisp"]
Versioning
This crate respects semver!
It will bump the major version (breaking release) when:
- Gitignores disappear from a collection
- Gitignores move from a collection to another
- Gitignores are renamed
- The minimum required Rust version increases
It will bump the minor version when:
- New gitignores are added to a collection
It will bump the patch version when:
- Gitignore contents change
This repo checks for updates to the gitignore repo once a day, and automatically releases if changes are found.
License
The published crate (gitignores
) is generated from the data, which is CC0-1.0, and so it
itself is CC0-1.0 (Public Domain).
The generator code is Apache 2.0 / MIT.
No runtime deps
Features
- community
- community-alteryx
- community-altium-designer
- community-auto-it
- community-aws-cdk
- community-aws-sam
- community-b4x
- community-bazel
- community-beef
- community-dot-net-core
- community-dot-net-infor-cms
- community-dot-net-kentico
- community-dot-net-umbraco
- community-elixir-phoenix
- community-embedded-atmel-studio
- community-embedded-esp-idf
- community-embedded-iar-ewarm
- community-embedded-u-vision
- community-exercism
- community-gnome-gnome-shell-extension
- community-golang-go-allow-list
- community-golang-hugo
- community-gretl
- community-hexo
- community-java-j-boss4
- community-java-j-boss6
- community-java-script-cordova
- community-java-script-meteor
- community-java-script-n-wjs
- community-java-script-vue
- community-lens-studio
- community-linux-snap
- community-logtalk
- community-move
- community-nasa-specs-intact
- community-nix
- community-open-ssl
- community-php-bitrix
- community-php-code-sniffer
- community-php-drupal7
- community-php-jigsaw
- community-php-magento1
- community-php-magento2
- community-php-pimcore
- community-php-think-php
- community-puppet
- community-python-jupyter-notebooks
- community-python-nikola
- community-racket
- community-red
- community-ros2
- community-sp-fx
- community-splunk
- community-strapi
- community-terragrunt
- community-toit
- community-ui-path
- community-v
- community-xilinx
- global
- global-al
- global-anjuta
- global-ansible
- global-archives
- global-backup
- global-bazaar
- global-bricx-cc
- global-calabash
- global-cloud9
- global-code-kit
- global-cvs
- global-dart-editor
- global-diff
- global-dreamweaver
- global-dropbox
- global-eclipse
- global-eiffel-studio
- global-emacs
- global-ensime
- global-espresso
- global-flex-builder
- global-gpg
- global-images
- global-j-developer
- global-j-env
- global-jet-brains
- global-k-develop4
- global-kate
- global-lazarus
- global-libre-office
- global-linux
- global-ly-x
- global-mac-os
- global-matlab
- global-mercurial
- global-metals
- global-microsoft-office
- global-model-sim
- global-momentics
- global-mono-develop
- global-net-beans
- global-ninja
- global-notepad-pp
- global-octave
- global-otto
- global-p-so-c-creator
- global-patch
- global-pu-tty
- global-redcar
- global-redis
- global-sbt
- global-slick-edit
- global-stata
- global-sublime-text
- global-svn
- global-syncthing
- global-synopsys-vcs
- global-tags
- global-text-mate
- global-tortoise-git
- global-vagrant
- global-vim
- global-virtual-env
- global-virtuoso
- global-visual-studio-code
- global-web-methods
- global-windows
- global-xcode
- global-xilinx-ise
- no-contents
- root
- root-actionscript
- root-ada
- root-agda
- root-al
- root-android
- root-app-engine
- root-appcelerator-titanium
- root-arch-linux-packages
- root-autotools
- root-ballerina
- root-c
- root-c-make
- root-c-plus-plus
- root-cake-php
- root-cf-wheels
- root-chef-cookbook
- root-clojure
- root-code-igniter
- root-common-lisp
- root-composer
- root-concrete5
- root-coq
- root-craft-cms
- root-cuda
- root-d
- root-dart
- root-delphi
- root-dm
- root-drupal
- root-e-pi-server
- root-eagle
- root-elisp
- root-elixir
- root-elm
- root-erlang
- root-expression-engine
- root-ext-js
- root-fancy
- root-finale
- root-flax-engine
- root-force-dot-com
- root-fortran
- root-fuel-php
- root-gcov
- root-git-book
- root-git-hub-pages
- root-go
- root-godot
- root-gradle
- root-grails
- root-gwt
- root-haskell
- root-iar
- root-idris
- root-igor-pro
- root-j-boss
- root-java
- root-jekyll
- root-jenkins-home
- root-joomla
- root-julia
- root-ki-cad
- root-kohana
- root-kotlin
- root-lab-view
- root-laravel
- root-leiningen
- root-lemon-stand
- root-lilypond
- root-lithium
- root-lua
- root-magento
- root-maven
- root-mercury
- root-meta-programming-system
- root-nanoc
- root-nim
- root-node
- root-o-caml
- root-objective-c
- root-opa
- root-open-cart
- root-oracle-forms
- root-packer
- root-perl
- root-phalcon
- root-play-framework
- root-plone
- root-prestashop
- root-processing
- root-pure-script
- root-python
- root-qooxdoo
- root-qt
- root-r
- root-racket
- root-rails
- root-raku
- root-re-script
- root-rhodes-rhomobile
- root-ros
- root-ruby
- root-rust
- root-s-cons
- root-sass
- root-scala
- root-scheme
- root-scrivener
- root-sdcc
- root-seam-gen
- root-sketch-up
- root-smalltalk
- root-stella
- root-sugar-crm
- root-swift
- root-symfony
- root-symphony-cms
- root-te-x
- root-terraform
- root-textpattern
- root-turbo-gears2
- root-twin-cat3
- root-typo3
- root-unity
- root-unreal-engine
- root-visual-studio
- root-vvvv
- root-waf
- root-word-press
- root-xojo
- root-yeoman
- root-yii
- root-zend-framework
- root-zephir
- root-zig
- std