gibo
is a great tool for creating .gitignore
files.
However, gibo
can improve some features in the aspect of managing .gitignore
.
Then, I sent a pull request to gibo
. However, it was not accepted because it seemed to be different from the author's direction.
Therefore, I created the wrapper of gibo
to introduce the new features for managing .gitignore
.
brew install tamada/tap/gibo-wrapper
git clone https://github.com/tamada/gibo-wrapper
cd gibo-wrapper
cargo build --release
# put the resultant executable 'gibo-wrapper' into the suitable location.
- install
gibo
command. - define
alias
in your.bashrc
or.zshrc
file.
alias gibo='gibo-wrapper $@'
- Use
gibo-wrapper
asgibo
.
gibo-wrapper
introduces the new commands current-list
and update dump
command for applying some options.
current-list
sub-command for gibo-wrapper
shows the list of boilerplates in the .gitignore
file in the current directory.
List the current boilerplates in the .gitignore file
Usage: gibo-wrapper current-list
Options:
-h, --help Print help
$ gibo current-list
macOS Linux Windows Go
VisualStudioCode JetBrains
The gibo-wrapper
updates dump
sub-command for adding four new options, --keep-prologue
, --remove-duplication
, --in-place
, and --verbose
, and two new modes, append mode and remove mode.
Dump a boilerplate
Usage: gibo-wrapper dump [OPTIONS] [ARGS]...
Arguments:
[ARGS]... the boilerplate names to dump.
Append boilerplates into the current .gitignore file if the name starts with `+`.
Remove boilerplates from the current .gitignore file if the name starts with `_`.
Options:
-k, --keep-prologue Keep the prologue of the .gitignore
-r, --remove-duplication Remove the duplicated boilerplate names
-i, --in-place Update .gitignore files in-place
-v, --verbose Show verbose output
-h, --help Print help
In the following example, gibo
is gibo-wrapper
, it is aliased.
If the arguments of the dump
command start with +
, gibo
dumps the boilerplates in append mode.
In append mode, at first, gibo
extracts the list of boilerplates from the .gitignore
file in the current directory.
Then, we add the arguments of the dump
command to the list by removing +
.
Finally, gibo
dumps boilerplates of the resultant name list.
$ gibo current-list
macOS Linux Go
$ gibo dump --in-place +windows
$ gibo current-list
macOS Linux Go Windows
Also, if any arguments of the dump
command start with _
, gibo
dumps the boilerplates in remove mode.
In the remove mode, gibo
removes the given names from the boilerplates list.
$ gibo current-list
macOS Linux Go Windows
$ gibo dump --in-place _windows
$ gibo current-list
macOS Linux Go
$ gibo dump --in-place macos linux windows _windows
$ gibo current-list
macOS Linux Go
--in-place
option is for updating the .gitignore
file in the current directory.
If you use redirect (>
), such as gibo dump +macos > .gitignore
, at first .gitignore
file is truncated and then the gibo
is executed.
Therefore, append, and remove mode cannot be used with redirect.
Hence, gibo-wrapper
introduces --in-place
option for updating .gitignore
.
In the use of gibo
, we sometimes add some content to the top of .gitignore
file.
In such a case, we want to keep the content.
--keep-prologue
option is for this purpose.
In the use of gibo
, adding/removing boilerplates may cause the duplication of boilerplates.
--remove-duplication
option removes duplicated boilerplates and dumps them.