navigate inside [mono]repos effortlessly!
APACHE-2.0 License
Travel Terragrunt, Terraform and ... ANY [Git] repository tree with no stress, as a first class passenger! ✈️
travelgrunt
alleviates the pain of hitting endless cd
/<TAB>
combos while navigating inside the repo.
💡 Video with a brief introduction and a demo is available here 🎥
cd
to the directory of your [locally cloned] Git repository;/
key to search for specific items;💡 If no configuration file found travelgrunt
will assume repository having only Terragrunt projects inside.
Create .travelgrunt.yml
file in the root path of your repository. Example config for a random monorepo:
rules:
- prefix: vendor/
negate: true
- prefix: terragrunt/
mode: terragrunt
- prefix: code/
name: '.*\.(go|js|css|html)$'
- prefix: config/
name: '*.yaml'
⬆️ Config is essentially a list of sequentially applied path matching rules. Each rule can have these fields:
prefix
- literal prefix to be matched against relative directory path;name
- a free form regular expression or a simple glob (name: '*.go'
) match applied to the file name;mode
- any matching behavior backed by a [custom logic] function from the mode
package;negate
- boolean directive that reverses the meaning of the match, excluding the paths matched;💡 Even while developing travelgrunt
itself we use it to navigate package directories of the application 🎩
You can search by the arbitrary expression instead of configured rules:
tg -x <EXPRESSION> [<match> <match2> ... <matchN>]
It is absolutely required to use zsh
aliases or bash
functions. Start from something like this:
alias tg='_tg(){ travelgrunt -out-file ~/.tg-path ${@} && cd "$(cat ~/.tg-path)" }; _tg'
alias tt='_tt(){ travelgrunt -top -out-file ~/.tg-path && cd "$(cat ~/.tg-path)" }; _tt'
function tg() {
travelgrunt -out-file ~/.tg-path ${@} && cd "$(cat ~/.tg-path)"
}
function tt() {
travelgrunt -top -out-file ~/.tg-path && cd "$(cat ~/.tg-path)"
}
These lines are usually added to ~/.bashrc
or ~/.zshrc
file, depending on your system and shell of choice.
💡 tt is a "convenience alias" that brings you to the top level path of your repository.
Core feature of this program is the ability to change working directory while staying inside the current shell.
This can not be done by the program itself, because of POSIX
security limitations. Without instrumenting
the shell with aliases travelgrunt
will not work!
CTRL+C
/ CTRL+D
behaviourWhen key combinations CTRL+C
or CTRL+D
get pressed during the execution, following occures:
CTRL+C
- program terminates with exit code 1
, under the starting directory path;CTRL+D
- program terminates with exit code 0
, under the directory path currently selected;homebrew
:brew tap ivanilves/tap
brew install ivanilves/tap/travelgrunt
cURL
+ sh
:Install latest release binary into /usr/local/bin
(default):
curl -s -f \
https://raw.githubusercontent.com/ivanilves/travelgrunt/main/scripts/install-latest.sh | sh
Install latest release binary into /somewhere/else/bin
:
curl -s -f \
https://raw.githubusercontent.com/ivanilves/travelgrunt/main/scripts/install-latest.sh \
| PREFIX=/somewhere/else sh
make dep
- install/ensure dependencies;make build
- build the travelgrunt
binary in cmd/travelgrunt
path;make install
- [optional] install built travelgrunt
binary under the ${PREFIX}/bin
location;💡 Make sure you have push permissions for this repository!
Run make release
recipe, which will:
main
branch;main
branch from remote;MAJOR
.MINOR
here if needed);