3

Lately I've had to write a bunch of CLI tools for repetitive tasks that any team member might run. I've been using normal bash for this, and it's great, but it feels a bit cumbersome when you have to do a lot of prompts and progress indicators. What other language would you suggest? GO would seem like a good candidate.

Comments
  • 6
    I've seen some nice little CLI tools written in Go, PHP, Python, Rust, etc.
    I would advise staying far away from Node, though.
  • 2
    Go is awesome, I use it currently for building cli for generating boilerplate code in interactive manner (4k loc atm), honestly I have nothing bad to say about it. It’s also not hard to learn, concurrency is easy, and it has super fast compiler which compiles into single cross-platform executable. Anyway, it’s a static language after all, and it may take some more time to implement something, compared to dynamic ones.

    As alternative, for quick/small scripts python is quite good and has huge ecosystem, downside - to run it you need python and all dependencies installed.

    Also check kotlin/native, I never tried it for real project, but it basically compiles kotlin/java into cross-platform native executable. But again, it’s a static language.
  • 2
    @Jilano node for cli? Shoot me in the face, I'm already falling into a mid life crisis and am pissed if I have to use that bullshit for normal projects
  • 1
    @Jilano @Kimmax, why though?
  • 5
    @Kimmax Don't ask me! I'm at a point where I'd rather do something manually than install 300MB of dependencies to use a little CLI tool. Not everyone seem to be thinking the same, apparently.

    PS: There's also a full terminal emulator made with Electron if you need one more reason on your suicide note.

    @nitwhiz *points* He told me to.
  • 1
    @Jilano PHP sounds even worse than Node to be fair... But then I'll learn go perhaps
  • 1
    I’ve been doing the same to speed up some process I run at home and been using Python alongside bash,

    only just started to learn Python but seems like there’s not much you can’t do with it
  • 0
    @bigOHNOtation Might be true, but there are other things to dislike with Python. Like fucking indentation and funky error messages
  • 1
    We've used Task for our current helper scripts. AFAIK it uses go as well

    https://taskfile.dev/
  • 0
    @olof I'll keep that in mind! I've actually been looking for an alternative to makefiles
  • 1
    Python because it's already installed everywhere.

    C because it's fast and you can make it as pretty as you want. Cross-platform takes more effort though.

    Ruby because it'll make your life easy -- though i have no idea if there's a good gem for console text graphics.

    Assembly because you want to torture yourself.
  • 1
    Best bash replacement would probably be Python imho, it's still a scripting language and easy to throw together into a working, useful program, and is usually fast *enough*.
Add Comment