My primary use case for Amber is when I need to write a Bash script but don't remember the silly syntax. My most recent Bash mistake was misusing test -n and test -z. In Amber, I can just use something == "" or len(something) == 0

you are viewing a single comment's thread
view the rest of the comments
[–] 22 points 8 months ago (4 children)

This is an interesting idea and from the looks of it well executed, but I am having trouble imagining a scenario were I would prefer to use Amber over a scripting language like Python. If your bash scripts are getting long enough to warrant the use of Amber you are probably already in a situation where you can justify installing Python.

  • source
  • hideshow 8 child comments
  • [–] 6 points 8 months ago (1 child)

    I agree, but I can envision scenarios where you are integrating into someone else's workflow/machine and they (or their build system etc.) are expecting a shell script. Python is ubiquitous but sometimes you just want to work like everything else.

  • source
  • parent
  • hideshow 2 child comments
  • [+] 3 points 8 months ago* (last edited 1 day ago) (1 child)
  • [–] 2 points 8 months ago* (1 child)

    Been there, done that lol. Nowadays, if I think that some script is getting too long, I just rewrite it in Go. It's faster to write than Rust (in fact, I find it almost as easy as Python), and performant enough for replacing scripts.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 0 points 8 months ago (1 child)

    @SinTan1729 @sga I've been toying with the idea of learning Go. I currently tinker in python and bash scripts. Is Go worth my time learning?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 8 months ago* (last edited 8 months ago)

    Oh, definitely. Its syntax is so simple, you can basically learn the basics over an afternoon. Outside of applications where consistent low latency is critical, if I can spare some extra RAM and CPU, I prefer Go to Rust.

  • source
  • parent
  • [–] 3 points 8 months ago

    One reason is that Python is not built-in on macOS anymore, so it's hard to justify using it for management scripts. Particularly when you do not have control of the execution environment to begin with. I've written some obnoxiously complicated bash (or zsh) scripts because I want to make sure it will run on a vanilla Mac with no additional dependencies. 10 years ago I would've done all that stuff in Python, but not anymore. Thanks, Apple!

    From a technical perspective, sure, I could push out a portable python environment and it wouldn't affect the rest of the system. But that comes at a cost. I don't want to fight for it, and I don't want to be responsible for maintaining it. It's easier to just use bash/zsh.

    Python is also too heavy for some embedded devices. Not sure if I can count on Amber scripts to run in a busybox environment but maybe?

    That said, if the question is "is it worth learning a whole new thing when I already know bash/zsh", I am not so sure. But in principle, I dig it, regardless of how practical it is with my specific background and needs. I mean, if I learned about this 20 years ago I feel like I might still be reaping rewards.

  • source
  • parent