1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//! Each gitignore is available as a variant of one of three enums:
//!
//! ```
//! dbg!(
//! gitignores::Root::Rust,
//! gitignores::Global::Emacs,
//! gitignores::Community::Racket,
//! );
//! ```
//!
//! The enums implement [`Display`](std::fmt::Display) / `.to_string()`, which will return the
//! contents of the gitignore file (only when the `std` feature is enabled, and the `no-contents`
//! feature disabled):
//!
//! ```
//! 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, by their variant names
//! fn list() -> Vec<&'static str>;
//!
//! /// Retrieve a gitignore dynamically, by its variant name
//! fn get(variant: &'static str) -> Option<Self>;
//! }
//! ```
//!
//! Finally, there is a constant with the git reference of the commit the crate was built from:
//!
//! ```
//! dbg!(gitignores::GIT_COMMIT_REF);
//! ```
//!
//! This is also available in the `package.metadata.gitignores` table in the Cargo manifest.
//!
//! ## 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:
//!
//! ```toml
//! [dependencies.gitignores]
//! default-features = false
//! features = []
//! ```
//!
//! ### Collections
//!
//! | Feature name | Path in github/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 lowercase.
//!
//! ### Other
//!
//! - `no-contents`: omit the embedded file contents, leaving only the metadata.
//! - `std`: implement the `Display` trait on the enums (except without `no-contents`).
//!
//! ### Examples
//!
//! #### All globals and only Rust root
//!
//! ```toml
//! [dependencies.gitignores]
//! default-features = false
//! features = ["global", "root-rust"]
//! ```
//!
//! #### Some specific gitignores
//!
//! ```toml
//! [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
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;