9

What language would you recommend for writing CLI tools quickly?

Comments
  • 14
    python
  • 9
    Obviously a brainfuck base, automatically ported to haskell at runtime
  • 4
    No seriously - it depends, as always, on what you want to do. A simple bash or sh script might do, maybe python or perl for more complexity or unleash the beast and do it in c++ or similar if it seems reasonably fit. But somewhere along the lines 'quickly' segfaults and your 10min project turns into a 6 hour regex interpreter
  • 4
    Perl, python, and ruby were pretty much designed exactly for this purpose. Python is easy to learn, but slower and more expensive. Perl is only slightly harder to learn, the code is more verbose, but only compiled code can parse and handle text faster and more efficiently. I can't really speak to ruby.
  • 8
    ...bash?
  • 2
    Perl.

    If not Perl then Python.

    If not Python, well go bash.
  • 4
    as the others said, it depends. But my order is bash, go, python, nodejs

    Bash for simple things
    Golang for portability (I use that heavily for CI stuff)
    Python for converters
    Nodejs for "Just work God damnit"
  • 0
    Python with docopt
  • 0
    Ruby is very neat.
  • 2
    @010001111 if your project runs on node, its not getting installed.
  • 5
  • 1
    I agree with the Python suggestions, also I'd add the libraries "argh" for argument parsing and "tqdm" for progress bars. You'll have readable code that does the right thing in no time.
  • 4
    @FrodoSwaggins
    Last time I checked html wasnt a programming language 🤔

    In general I find it hilarious how emotional some people get in this thread over something like the language used to write a cli tool. The world doesnt stop turning if I write a little cli util in node or python. Its fast enouh and doesnt consume gigabytes of ram ;)
  • 0
    @SevenDeadlyBugs deep
  • 2
    @irene npx comes with most dependencies you want for that. Install library xy that does most of the work and glue it somehow (preferably async) together.

    If a project depends on this script, just mention it's requirements as optional, who cares where the script is. Just shebang the shit out of it.

    Try it, my reaction was "pretty fast for shitty pastings", 7/10 would do again
    Or trust my coworker "The QuickFix. (forever)"

    @Kimmax Sorry, I know I'm addicted, but it just feels right, I can't get off from it. We have shitty error messages, so now every exception throws a second exception with the message "Nope, sorry!". At least they get logged.
  • 1
    Maybe groovy, if you're a Java dev
  • 1
    @jespersh yes.

    I’d either use Python or C# to do it. Or C for funsies.
  • 0
    Php ... :D
  • 1
    Depends on the complexity of the task and what it is.

    Bash, Perl, Python, C/C++.
  • 1
    has anyone mentioned Go?
  • 4
    Python. It's an opinion that this thread is fighting over apparently. It won't run quickly, it will use more memory than nessesary, it will have multiple imports and dependencies, but it will develop quickly!

    Write it in python. With argparse, you'll be done in 10 minutes. Run it, be happy. Then realize you're bored, it's slow, and could be better. Then write it in perl or C or golang or etc.

    But python is a great "I don't have time for this. I want it done now. Not perfect, just now" language.
  • 1
    Javascript. Not kidding, I write stuff in javascript.
  • 0
    @rEaL-jAsE Linux primarily. Though it sadly has to work on windows aswell
  • 1
    Node.js
Add Comment