7

What language would you recommend for writing CLI tools quickly?

Comments
  • 15
    python
  • 23
    The one you are most productive with
  • 11
    Obviously a brainfuck base, automatically ported to haskell at runtime
  • 7
    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
  • 7
    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.
  • 11
    ...bash?
  • 4
  • 3
    @SevenDeadlyBugs do not do this is the language you are most productive with is html.

    There’s the right tool for the job and the wrong tool for the job sometimes (read: most times) you’re not going to use a nail to drive in a hammer.
  • 7
    @FrodoSwaggins in this case he asked for language to write tools Quickly, which is usually the one you already know. Picking new language won’t be faster, because you need to learn it first. But considering rightness, then I would recommend golang, because it doesn’t need dependencies to run once compiled, so easily to distribute.
  • 6
    dotnetcore :P
  • 2
    Perl.

    If not Perl then Python.

    If not Python, well go bash.
  • 0
    @SevenDeadlyBugs so if he picked html because he already knew it you’d be ok with that. Are you for real right now?

    I’m most familiar with PowerPC and arm assembly but I’m not going to use those to make shell utilities. After that I’m most familiar with c++ which is not a bad bet but there are still better tools for the job *DEPENDING* on what the task is that I need to accomplish. There are obvious cases where C/C++ are the way to go. I know python and bash but they are not something I’m as familiar with as c++. If I needed to make a quick utility script though, obviously they are going to provide advantages that far exceed my familiarity with c++.

    You aren’t going to drive in a hammer with a nail. Sometimes there’s a right tool or class of tools if you will for the job.

    Don’t write shell scripts in html. Or actually, do and let us know how that goes.
  • 3
    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"
  • 4
    @FrodoSwaggins any sane person could understand that OP asks for programming language, and not markup.

    You also said that you know python and bash already, so in your case u would pickup one you feel is most productive for your use case.
  • 0
    @SevenDeadlyBugs know enough to scrape by. I’m more productive in c++ but it’s a fundamentally different tool for a fundamentally different functional area. A lot of core utils are written in c but they are fairly complex, and to be fair most were written long before python existed. You can’t just assert to use your favorite language with everything. Shit like that is what led to electron and JavaScript based desktop editors that take multiple gigabytes of ram. It’s madness. There’s a right tool for the job sometimes.

    I thought my point was clear. You don’t write a script in arm assembly even if it’s your most productive language.
  • 7
    @010001111 node for cli applications? Really? 😐
  • 2
    @irene laughed out loud XP
  • 0
    Python with docopt
  • 0
    Ruby is very neat.
  • 3
    @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
    @musician well python is a great choice to write a simple CLI tool in. I sure hope the world doesn’t stop turning for making great decisions...
  • 0
  • 1
    @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.
  • 0
    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
  • 2
    Depends on the complexity of the task and what it is.

    Bash, Perl, Python, C/C++.
  • 2
    has anyone mentioned Go?
  • 6
    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.
  • 3
    @010001111 totally unacceptable.
  • 1
    For which environment? I'd recommend C.
  • 1
    Javascript. Not kidding, I write stuff in javascript.
  • 1
    @rEaL-jAsE Linux primarily. Though it sadly has to work on windows aswell
  • 1
    @ScriptCoded What about Vala? Vala is pretty much a good rip off of C# and works with windows and Linux.
Your Job Suck?
Get a Better Job
Add Comment