←back to thread

203 points dahlia | 1 comments | | HN request time: 0s | source
Show context
bschwindHN ◴[] No.45156696[source]
Rust with Clap solved this forever ago.

Also - don't write CLI programs in languages that don't compile to native binaries. I don't want to have to drag around your runtime just to execute a command line tool.

replies(9): >>45156782 #>>45156785 #>>45157057 #>>45157203 #>>45158148 #>>45159646 #>>45160365 #>>45161166 #>>45163035 #
majorbugger ◴[] No.45156782[source]
I will keep writing my CLI programs in the languages I want, thanks. Have it crossed your mind that these programs might be for yourself or for internal consumption? When you know runtime will be installed anyway?
replies(2): >>45156801 #>>45157855 #
dcminter ◴[] No.45156801[source]
You do you, obviously, but "now let npm work its wicked way" is an offputting step for some of us when narrowing down which tool to use.

My most comfortable tool is Java, but I'm not going to persuade most of the HN crowd to install a JVM unless the software I'm offering is unbearably compelling.

Internal to work? Yeah, Java's going to be an easy sell.

I don't think OP necessarily meant it as a political statement.

replies(3): >>45156969 #>>45158151 #>>45160329 #
goku12 ◴[] No.45156969{3}[source]
There should be some way to define the CLI argument format and its constraints in some sort of DSL that can be compiled into the target language before the final compilation of the application. This way, it can be language agnostic (though I don't know why you would need this) without the need for another runtime. The same interface specification should be able to represent a customizable help/usage message with sane defaults, generate dynamic tab completions code for multiple shells, generate code for good quality customizable error messages in case of CLI argument errors and generate a neatly formatted man page with provisions for additional content, etc.

In fact, I think something like this already exists. I just can't recollect the project.

replies(1): >>45158329 #