6 ms·
As someone who uses neither Just nor Make, I'm trying to understand the value proposition. From what I can tell, Just accomplishes what a set of scripts in a d
by justin_oaks 4y ago
As someone who uses neither Just nor Make, I'm trying to understand the value proposition.
From what I can tell, Just accomplishes what a set of scripts in a directory could also do, but in a more ergonomic fashion. Since the justfile is a single file, you're not cluttering up your directory. You don't have to look for all *.sh files, but can instead do a "just --list". And using "just target" is probably easier to type than "./target.sh" since the just version has no punctuation.
What are some of the other benefits of Just that makes it superior to "a set of scripts in a directory"?
- arjvik 4y agoJob pipelines - it's easy to say that the build-release step requires the test step. Admittedly this is still possible in a shell script, but it is either messy (folder of helper scripts?) or requires code duplication.
- chillfox 4y agoYou know shell scripts can have functions right? And nice stuff like command/options parsing + nice help messages.
- dividedbyzero 4y agoJust has pretty ergonomic support for argument parsing [1] and help messages [2]. You're right about functions of course. 1: https://github.com/casey/just#recipe-parameters https://github.com/casey/just#recipe-parameters 2: https://github.com/casey/just#documentation-comments https://github.com/casey/just#documentation-comments
- simonw 4y ago"Just accomplishes what a set of scripts in a directory could also do, but in a more ergonomic fashion" That's exactly the value proposition here. It's a small quality of life improvement, nothing more.
- noobermin 4y agoThen this is good, but hopefully scope creep doesn't creep in. I'm not a software developer, but a scientist, and eventually like 5 shell scripts fill a directory. Having them all be in one place sounds neater and easier to document and come back to a few months later without needing to either open up each individual file to read its own comments or to make a separate readme file, seems good for small projects.
- pletnes 4y agoDon’t forget discoverability - writing «make» and whacking tab gives you a nice menu of what can be done with the Makefile. (Just, too.)
- skoob 4y agoBut any shell that tab completes make targets should also tab complete executables? Just write ./scripts (or whatever) and whack tab.
- pletnes 4y agoI don’t know where to start when the script is in ./Scripts/ or ./tools or ./bin or ./shared/tools. Make has a convention that its file is called Makefile. Just has Justfile. Easy to find. Justfile - here I don’t even have to find it, the «just» executable will search up the directory tree.
- accoil 4y agoYou can also run it from any subdirectory as if they were in the root of a project (it searches the parents for the nearest justfile). E.g 'just build' from /proj is the same as when it is executed from /proj/lib1/module1/ without having to think about what the relative path should be.
- thebeardisred 4y agoThat sounds like one path traversal bug away from a bad idea.
- shzhdbi09gv8ioi 4y agoobviously ginger snark. this is also how cargo works.
- bpicolo 4y agohttps://github.com/casey/just#recipe-parameters https://github.com/casey/just#recipe-parameters Accepting arguments alone seems to be a pretty big value add.
- chillfox 4y agoIt's nice you don't have set it up yourself, but it's hardly difficult to do in a shell script.
- shzhdbi09gv8ioi 4y agoI think the more reasonable comparison is with Make.
- stefanha 4y agoVariables can be set on the command-line: https://www.gnu.org/software/make/manual/make.html#Overriding https://www.gnu.org/software/make/manual/make.html#Overridin... $ make HOST=dev1.example.org deploy Environment variables are also available in makefiles.
- rm445 4y agoBecause task runners come from the lineage of build systems, I (previously) would have thought that smart management of dependencies was a critical feature, especially skipping outputs whose inputs haven't changed, so that tasks can be run efficiently. Make and rake both do this. But I guess, enough of the time, what people want is just a nice tidy way of organising tasks to run. Not drastically different to a set of shell scripts, but organised differently, with a few extra features and less boilerplate per task.
- yeck 4y agoIt isn't anything revolutionary, just helpful. I think of it like a lightweight framework for writing shell scripts.
- slotrans 4y agoDependencies.
- DrBazza 4y agoThey are both directed graphs that support dependencies, i.e. if you run `make a` or `just a` and they depend on b and b depends on c, both tools will build c first, then b, then a. What often happens is that people should use `make` (or `just`), but don't, and instead end up writing a poor replica of `make` as a custom python script for example. And then that python script perhaps shells-out to a subprocess because you can't run something in python directly as a lib, so now you have to import and invoke subprocesses, and so on. Building and deploying a static website using just or make is 4 lines.
- joshspankit 4y agoThis should be in their README. After looking at the repo and some of the comments here, yours was the moment I went from “what exactly is the value prop?” to “that could be useful for me”
- oslac 4y agoUniform interface that abstracts over commands? Nice when you have either bad command / build system or multiple in same project?
- PurpleRamen 4y ago> Since the justfile is a single file, you're not cluttering up your directory. You can do the same with any other scripting language, because with most popular languages it's quite easy to handle cli-parameters on that level. And using a single messy file is usually not a good pattern. But on the other side, "just" comes with builtin tab completion which you would not get for any random script out-of-the-box. And if you are only using half oneliners or very short scripts, the messiness of a single file does not matter that much. Though, how well this will scale over time is a different topic.
- dividedbyzero 4y ago> And using a single messy file is usually not a good pattern. I find my Justfiles rarely ever get large enough to become messy, and then I just factor out the large tasks as scripts and it's all nice and tidy again. Almost all of my projects with a Dockerfile have docker-build and docker-run-local just tasks and those are pretty much always one-liners, and usually that's as complex as it gets. I treat Justfiles more like runnable readmes than a framework for homebrew build systems; if I need a proper build system, I'm probably going to invoke it via a one-liner in a just task.