3 ms·
Well, for one, your recipes can be in another language (e.g. Python). You can build complex recipes out of simpler ones. Sure, you could do that by creating a
by BeetleB 2y ago
Well, for one, your recipes can be in another language (e.g. Python).
You can build complex recipes out of simpler ones. Sure, you could do that by creating a new shell script that calls other shell scripts, but then you're reinventing just.
You don't need to be in the directory to run those scripts.
I think a better question for you: What's the benefit of putting .PHONY recipes in Makefiles, when you could just have a directory full of shell scripts. If you find yourself using .PHONY recipes, then you already have a reason to use just.
- e12e 2y ago> Well, for one, your recipes can be in another language (e.g. Python). Surely this is true for stuff in a ./bin or ./scripts folder - binaries, python with shebang etc?
- e12e 2y agoAh, I see there's: https://just.systems/man/en/shebang-recipes.html https://just.systems/man/en/shebang-recipes.html Which could be done in shell, but typically rather be limited to oneliners (invoking awk) rather than piping a heredoc to an interpreter.
- akoboldfrying 2y ago> You don't need to be in the directory to run those scripts. There's already an easy way to solve this: $PATH. > I think a better question for you: What's the benefit of putting .PHONY recipes in Makefiles, when you could just have a directory full of shell scripts. If you find yourself using .PHONY recipes, then you already have a reason to use just. Well, I think it's the same question, rather than a better question. And the answer is yes, if all you need from make, now and in the future, is a set of .PHONY targets, then by all means just use shell scripts. make is used because often you need slightly more than this -- or you may do so tomorrow, and don't want to change the syntax you use to accomplish tasks.
- BeetleB 2y ago> There's already an easy way to solve this: $PATH. I have 10 projects. Each with their own set of shell scripts. You want me (and all other developers) to pollute the $PATH with 10 directories? And then you have a namespace problem. I usually have a "test" recipe in my justfiles. The analog would be a test.sh file. But with your solution, it will have to be projA-test.sh and projB-test.sh. And if I dump them all into the $PATH, how do I quickly see the scripts relevant to a particular project?
- L3viathan 2y agoYou can put `./scripts` in your $PATH, if you want.
- kstrauser 2y agoAbsolutely do not do this. That’s all well and good until you clone a repo that ‘scripts/ls’ => install_ransomwhere().
- olejorgenb 2y agoYou could put `.$MY-SECRET` it `PATH` and selectively symlink this to vetted script directories
- olejorgenb 2y agoYou can put .scripts last in PATH (or first - whichever disallows scripts/ls to take precedence over /usr/bin/ls)
- BeetleB 2y ago1. This requires that all your projects use "scripts" as the directory name. 2. This works only if you just happen to be in the directory above scripts.
- nerdponx 2y agoDirenv is a great tool for this FWIW.