6 ms·
If you're going to use it like Make without the build system parts, why not just have a directory of tiny scripts? More portable than either, the only boilerpla
by l0b0 4y ago
If you're going to use it like Make without the build system parts, why not just have a directory of tiny scripts? More portable than either, the only boilerplate is a shebang line, and you can use static analysis tools (shellcheck), formatters (shfmt) and the like.
Take the example they've screenshotted in the readme[1]:
alias b := build
host := `uname -a`
# build main
build:
cc *.c -o main
# test everything
test-all: build
./test --all
# run a specific test
test TEST: build
./test --test {{TEST}}
The equivalent would just be something like the following:
build.bash:
#!/usr/bin/env bash
set -o errexit
cc *.c -o main
test-all.bash:
#!/usr/bin/env bash
set -o errexit
"$(dirname "${BASH_SOURCE[0]}")/build.bash"
./test --all
test.bash:
#!/usr/bin/env bash
set -o errexit
"$(dirname "${BASH_SOURCE[0]}")/build.bash"
./test --test "$@"
If you want to get really fancy you could make a common.bash with safety pragmas and things like the host string.
[1]: https://github.com/casey/just/blob/master/examples/screenshot.just https://github.com/casey/just/blob/master/examples/screensho...
- pletnes 4y agoJust runs fine on windows, too, which most people seem to miss. Bash is not always available, make even less so.
- oso2k 4y agoAs matter of practice, I always install git-bash or MinGW or CygWin on my Windows boxes. There's only one instance I've found where these solutions were not sufficient for my uses cases and it was an admittedly horrible corner case where a customer's network forced me to not "do the right thing(tm)".
- pletnes 4y agoHaving tried all 3, I’ll warmly recommend WSL2 instead, which is basically linux. But many people do work on windows, even write software for it. While I’m in your Linux based corner, some people aren’t, and it’s nice to share a task runner with them. Last time I checked, git bash doesn’t ship make, either.