[HN Gopher] Show HN: Just.sh - compiler that turns Justfiles int...
       ___________________________________________________________________
        
       Show HN: Just.sh - compiler that turns Justfiles into portable
       shell scripts
        
       Justfiles are like Makefiles, except Just is a command runner,
       whereas Make is a build system. As I understand it, Just was built
       to be a less arcane version of Make for collecting commands common
       to a code repository.  When I first learned about Just, I realized
       that parsing arguments and running commands is exactly what shell
       scripts do, and there probably isn't much Just does that sh
       doesn't. This project proves that hypothesis by compiling Justfiles
       to portable (POSIX-compatible) shell scripts.  just.sh is
       particularly useful for running Justfiles in esoteric environments
       where Just may not be straightforward to install, such as some
       CI/CD pipeline environments.
        
       Author : jstrieb
       Score  : 42 points
       Date   : 2023-12-26 14:30 UTC (8 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | metaketa wrote:
       | This is great! Never knew there was something specific existing
       | as command runner except for arcane or programming-lang specific
       | tools (i.e. Rake, the Cargo one, etc). I have been abusing
       | Makefiles as command runners for years now.
        
         | jstrieb wrote:
         | Thanks!
         | 
         | Yeah, Just is pretty awesome! Its biggest drawback over Make is
         | that you can often assume Make is installed, whereas it's not
         | always clear that Just needs to be installed if you've never
         | heard of Justfiles before, let alone how to install it.
         | 
         | There are a few design decisions where I think Just missed an
         | opportunity to improve on Make, but they're all pretty minor.
        
       | simonw wrote:
       | I really like Just, with the only drawback being that you need a
       | Just installation to run a Justfile.
       | 
       | This is a really clever solution to that problem!
        
       | justinyan wrote:
       | I'm a fan of using just as a command-runner as well, but took a
       | slightly different approach to making it pip-installable! I
       | created the `pyjust` package (https://pypi.org/project/pyjust/),
       | which literally just packages the `just` binary in platform-
       | specific wheels, and then unpacks it onto the PATH by leveraging
       | the `scripts` directory unpacking.
       | 
       | Why do this you might ask? My rationale here was that I use
       | `pipx` to install some python CLIs, and it was nice to be able to
       | lump `just` in with that, as well as to be able to declare it as
       | a "dependency" and pin specific versions for distribution.
        
       | mongol wrote:
       | Does it have bash autocompletion support?
        
       | latchkey wrote:
       | This is fantastic, but I'd say that this solution is somewhat in
       | response to this open issue from 2019:
       | 
       | https://github.com/casey/just/issues/429
       | 
       | I really wish just was included as a package in distributions.
        
         | jstrieb wrote:
         | I share your wish. This project started out because Just is not
         | apt installable. But at a certain point, it became a "just for
         | fun" project (pun intended).
        
           | latchkey wrote:
           | You're totally right, it is a fun project. The problem is
           | that if I'm writing Justfiles and transpiling them to
           | shell... now I have 3 problems. Just, Python and shell.
        
             | derefr wrote:
             | Presuming the just.sh compiler is doing everything right,
             | you _shouldn 't_ have a shell problem, any more than using
             | C compiler means you now have an assembly-language problem.
             | 
             | Also, the trade-off here (in my mind, at least) is that you
             | could _maintain_ higher-level Justfiles, but _distribute
             | releases_ containing the portable-shell-script artifacts of
             | said compilation -- so that anyone using your package doesn
             | 't need just, only a POSIX environment.
        
         | fbdab103 wrote:
         | Woof, four years. Is packaging really that complicated?
        
           | jstrieb wrote:
           | My understanding is that building a .deb is not too hard. The
           | hard part is finding a willing Debian project sponsor to add
           | the package to the archive.
           | 
           | https://wiki.debian.org/DebianMentorsFaq#How_do_I_add_a_new_.
           | ..
        
         | xonix wrote:
         | makesure, a similar tool (https://maximullaris.com/makesure-vs-
         | just.html) I'm developing, doesn't require installation in the
         | traditional sense:
         | https://github.com/xonixx/makesure#installation.
         | 
         | Also, I was considering adding the same feature (generating the
         | equivalent shell script) to my tool, but after doing some
         | analysis decided not to pursue this idea for the following
         | reasons: https://github.com/xonixx/makesure/issues/83#issuecomm
         | ent-98....
        
       | flir wrote:
       | https://github.com/batsh-dev-team/Batsh
       | 
       | https://github.com/tdenniston/bish
       | 
       | (Just fyi. I've been collecting links to similar things because
       | of Reasons).
        
       | jitl wrote:
       | Given these examples of a Justfile, it doesn't seem worth this
       | effort versus using a Makefile and not needing a compilation step
       | (assuming Make is available everywhere). Does anyone have a
       | Justfile example complex enough to demonstrate a significant
       | advantage over Makefile?
        
         | nrabulinski wrote:
         | Just is fundamentally less capable but by extension less
         | complex, and that's by design. It's essentially a way to group
         | your shell scripts for a given project. It's somewhat similar
         | to make in terms of syntax but it doesn't do anything make does
         | like tracking whether a task needs to be rerun
        
       | charles_f wrote:
       | What is the upside compared to just creating the corresponding
       | shell scripts? I can see that one file instead of how many more
       | is better, but it's also one thing more to worry about and
       | confuse people on your project, surely there's more to it?
        
       ___________________________________________________________________
       (page generated 2023-12-26 23:01 UTC)