1. 32

  2. 21

    Strange world, I just use a case statement in a shell script

    case $1 in
        foo) echo hello ;;
        bar) echo world ;;
    1. 6

      Me too - crazy this exists. I don’t know how we got to this point.

      sh -x and you also get perfect debugging output.

      1. 3

        And with https://github.com/koalaman/shellcheck you get an extremely valuable linter as well.

    2. 5

      I’ve been using just for a few years now and am very happy with it. Although I started using it somewhat like make I’ve since grown to use it in areas like baseline setups, certain task automation situations where I don’t want to use bare shell scripts. It’s been great, and constantly improving!

      1. 3

        Sounds like it doesn’t try to avoid redoing redundant work. Is this right?

        1. 2

          That’s right; just isn’t a replacement for make, it’s a replacement for those little pseudo-scripts I used to keep in my shell history.

          1. 1

            Does that mean that you’ll need make to build the project, and then just to run commands?

            1. 2

              In the Further Ramblings section at the end of the README, the author suggests using just to trigger all commands, including build commands, in a language-agnostic way. They link to just’s justfile, which has a build command that runs cargo build. So yes, if you are writing code in an ecosystem for which Makefiles are the best, you might end up using just to call make.

              But if you don’t like that pattern, you could use just only for small projects that don’t need building (e.g. ones written in Ruby or Python). Or you can run all your commands with make by defining .PHONY targets in your Makefile.

        2. 1

          I tried this, but I’d like something where I can use cd or source.

          So I made this: https://gist.github.com/HackerFoo/19f3666e7feb93df2e5b4d2c22991029

          The commands are just what I’m working on right now; it’s easy to modify, and sources itself each time the go function is called.

          1. 1

            Implicitly sourcing a bash script that happens to be in the same directory seems really insecure.

            1. 1

              It expands to an absolute path: source ~/.go.bash

              1. 1

                Also, isn’t make or just almost as insecure?

                1. 1

                  Oh, you’re right. I misread it. I thought it was project-specific, but it’s actually system-wide. My mistake. Carry on.