Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
![](/static/devrant/img/pipeless-devrant-banner-white.png)
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4682465y@chabad360 how does it not matter what it's being used for?
Yes php can be ran at cli and swift is open source so can also be used in cli.
Honestly, if you're just making a cli tool just for the sake of it, use anything you're already comfortable with. -
Root823425y@chabad360 Ruby needs the interpreter. However, there is a (very alpha) variant called Crystal that's statically typed and compiles.
-
Root823425y@chabad360 I can't speak to Crystal, but plain Ruby is probably more than fast enough for whatever you're doing? But if you need pure speed, the answer is always C. Or Assembly.
-
@jurion I plan on trying it out actually, but it makes it very annoying to distribute...
-
The C family does pretty well here. The major operating systems all have advanced console control APIs available in c/c++. There are lots of curses libraries in every language but not many Windows libs so you may need c/c++ for that. That being said, I think your BEST bet is c#
It has cross-platform basic console control available out of the box and isn't too difficult to write. It's overlooked in CLI because it's way more often used in GUI but C# is very very good for the basic program's needs. -
@AlgoRythm I have learnt C#, and as I use Linux I've been hunting for a good excuse to work with it again. But do you know any good ways for handling arguments?
-
@chabad360 I've actually never really used them much. My design is to set up a faux GUI in the console and accept user input that way.
In what way do you need to handle arguments? When I have done it, I just iterate over them manually at startup and analyze them. If they start with a single dash I analyze them character by character, and double dashes are human readable so I just do string comparisons. -
@AlgoRythm my main issue with that, is if you want to use such a tool in a script, it's down right impossible...
That's an obvious approach, but I find it to be a massive pain...
Maybe when I'm bored, I'll write a lib do handle it... -
@chabad360 shouldn't be too hard of a lib. But I think dealing with arguments is a pain, any way that you slice it.
-
@AlgoRythm true, but if you, say make it virtually autonomous, and all you have to say is what are the expected args and what needs to happen, you avoid that issue entirely.
-
@chabad360 some libs you can check out: https://stackoverflow.com/questions...
-
simondo92325yPython and it's argparse library make writing CLI applications pretty straightforward. There's also lots of guides and tutorials.
-
Pretty much any language would work just fine here tbh. I'll pitch in Haskell and the Haskeline library for CLI programs.
Minimum runtime dependencies would probably be systems languages like C, C++, Rust etc. since most of their dependencies are in the OS itself. -
@SunnySoldier357 thanks a lot for that!
@simondo92 yes I know of it, and I actually like it, aside for one thing... Speed. Any Python CLI I've encountered, is slow...
@ethernetzero Bash is good for scripts not CLI apps. Python, see above. Go I've never tried and I want to learn it, but do you know if any good ways for parsing arguments? -
@chabad360 Does your idea of a “CLI app” require the app itself to be compiled in binary form? Because I disagree. You can definitely write a CLI app using Bash, and you can definitely parse arguments using the getopt builtin command, and it's not even a hard thing to do at all.
Also, dismissing Python because it requires having a runtime installed is the same argument that could be made about .NET. Entire applications, both GUI and CLI, are written in Python and you might not even know it. The argparse library, that comes bundled with Python already, is really good for argument parsing.
About argument parsing in Go, it already comes with a module for that, called flag. There are third party modules out there that add features to it, but it already comes with batteries included. -
@ethernetzero no, it doesn't need to be compiled, but that happens to be faster, easier to distribute (like a bash script or python script, but see my issues below).
I know what you can do In bash, I've tried it alot, but it's really not very convenient at all, and requires a fair amount of extra logic just to work, plus getopt/s has its own set of issues.
Pythons main issue isn't that it requires the runtime, it's that it's slow, dotnet isn't. When I first encountered the argparse lib I really liked it, but then again, it's just slow...
Great to know about Go, once I sit down and actually learn it, I'll definitely have a look at that. -
@chabad360 You could have a look at the command line extensions package on nuget
Related Rants
-
JMoodyFWD48My "Coding Standards" for my dev team 1.) Every developer thinks or have thought their shit don't stink. If y...
-
nickj58today at programming class... professor: today we will be teaching you about vim and using the terminal and s...
-
AdeE16
I love to help people, with the easiest possible solution 😍😍😍
What would all you guys say is a good (preferably easy) language for writing CLI applications? Something that runs fast, the less dependencies at runtime the better, and (this goes lower on the list)of thess logic required for argument handling the better.
question
languages
language
cli
easy