It's a wrapper around your commands!
Let's imagine you have 2 projects, and you want to run tests in each project.
Project A, is a Laravel PHP project, so you want to usephpunitorpest.Project b, is a JavaScript project, so you want to usejestornpm run test.
I don't want to remember all of that... Let's fix it.
cd ~/projects/php_project_a
taco add test -- phpunit
cd ~/projects/js_project_b
taco add test -- npm run testSo what happened here? We created aliases!
This is what the config looks like in ~/.config/taco/taco.json
{
"projects": {
"/Users/robin/projects/php_project_a": {
"test": "phpunit"
},
"/Users/robin/projects/js_project_b": {
"test": "npm run test"
}
}
}From now on, I can just write taco test regardless of the project I am in, and it will execute the corresponding command. This is awesome because I work
in a lot of different projects, and a lot of them are not even mine. It would be stupid to change all the scripts for each project just because I like npm run tdd instead of npm run test:watch as a script name.
Scripts inherit scripts from parent directories. This allows you to set the npm run test only once in a shared folder. In my case, I did this in a ~/github.com/tailwindlabs folder.
This is how I use it personally:
{
"projects": {
"/Users/robin/github.com": {
"tdd": "./node_modules/.bin/jest --watch",
"test": "./node_modules/.bin/jest"
},
"/Users/robin/github.com/tailwindlabs": {
"dev": "next dev"
},
"/Users/robin/github.com/tailwindlabs/tailwindcss": {
"build": "bun run swcify",
"watch": "bun run swcify --watch"
},
"/Users/robin/github.com/tailwindlabs/headlessui": {
"vue": "yarn workspace @headlessui/vue",
"react": "yarn workspace @headlessui/react"
}
}
}- This is a Rust project and the binaries are not published anywhere. This means that you need to have Rust/Cargo installed.
cargo build --releaseThis will create a taco binary at ./target/release/taco.
I am using zshrc, and I make sure to export the ./target/release/ folder so
that I can automatically run the taco binary.
PATH=./target/release:$PATHIn addition, I also have this PATH, so that I can run taco from
anywhere on my system.
PATH=/path-to-taco-project/target/release:$PATHtaco add lsThis will open your default editor ($EDITOR env variable) to input the command. Lines with # at the start will be ignored.
taco add ls -- ls -lah
# Aliased "ls" to "ls -lah" in /Users/robinPerforms the same action as above, but without opening an editor. This is useful if it's a simple one-liner command.
taco edit lsThis will open your default editor ($EDITOR env variable) to edit the command. The current command will be pre-filled. Lines with # at the start will be ignored.
taco ls
# total 680
# total 680
# drwxr-x---+ 59 robin staff 1.8K Dec 1 21:06 .
# drwxr-xr-x 5 root admin 160B Nov 15 18:46 ..
# -rw-r--r--@ 1 robin staff 18K Dec 1 19:38 .DS_Store
# drwx------+ 56 robin staff 1.8K Nov 29 18:43 .Trash
# ...Or if you want to look at the command that is going to be executed use the --print flag.
taco ls --print
# ls -lahtaco print
# Available commands:
#
# taco test
# ./node_modules/.bin/jest
#
# taco ls
# ls -lah
#
# 2 commandsOr..
taco print --json
# {
# "ls": "ls -lah",
# "test": "./node_modules/.bin/jest"
# }taco rm ls
# Removed alias "ls"Inspired by the awesome Projector tool by ThePrimeagen!