Like with C++ and python there are standard parsers and predefined simple rules that apply to 90% of usage, and then anyone is free to write a parser if they want with features like subcommands, exclusive options and so on. I would say using SYNTAX=getopt would just follow a specific version of getopts, including one specifically defined for the purpose of the standard if need be. If syntax=namelist it would follow the rules for NAMELIST syntax. Allowing just NAMELIST syntax, which is already part of the Fortran standard would be better than the current state, and make it trivial to enter small arrays, numeric values using engineering syntax, and so on. I do exactly that on some programs now, by reading all the arguments and wrapping them in a NAMELIST group.
As far as what I personally like to do to handle subcommands, lists and ranges of values, exclusive arguments and such, see the M_CLI2 module referenced above, which allows for all that plus user-defined abbreviations for complex parameter combinations and so on. But I think that goes too far for what I am proposing;, i am picturing something very intentionally much simpler and trivially easy to use, as described above (just add the variable names to the program directive and insist they have default values (maybe).
Regarding some languages having a standard but other parsers still being created …
It might be that you could say python failed because there are other parsers available but it is even more likely the simple standard they provide is used a large percentage of the time, and like anything else there are special cases or variants that others write additional parsers for. It would be nice to see usage counts of the standard interface versus the custom libraries but I don’t know of a trivial way to garner them.
I have one I use a lot that much like the old CDC NOS CCL format allows for a line mode program to automatically invoke a screen mode, but unfortunately it is in a proprietary environment;but I think that gives me a good feel for how useful that can be compared to the current GNU/Linux CLI state of affairs.
A simple mockup giving a glimpse of how that old NOS CCL might look today with GNU/Linux is shown below for the cp(1) command. The idea is you would use cp(1) exactly like you do now, but if you specified a special character (NOS used a ?) an interactive mode is invoked. If your screen type is not “dumb” or if you did not ask for terminal mode a screen mode comes up much like curses/Pcurses/ncurses programs use; I would like to see that available on Linux as a standard feature all languages could use but I am not proposing that for the Fortran header syntax.
A calculator is not useless if it cannot solve a PDE problem, a parser that only allows getopt_long-like parsing using one additional line in the code is not a bad idea just because it does not automatically generate a CANVAS or X11 interface or allow for subcommands. That logic would lead to saying all intrinsics in Fortran are useless because they do not support arbitrary precision or units or do not return error ranges on answers.
Regarding the article on CLI interfaces …
I threw together an interface using fixedform(1) from the GPF site (which has not been worked on in a while – caveat emptor) to simulate what a CDC NOS screen would look like for an automatically generated interface to a script, “unix-izing” it a bit.
I think this is
something reminiscent of the old auto-generated NOS CCL script interfaces. A screen interface with context help was auto-generated for any script nearly 40 years ago!
The article about unix CLI scripts I almost entirely agree with, but the state of things described years ago was the state of Unix; other OSes like NOS, NOS/VE, VMS, Aegis and IBM systems had far more elaborate scripting interface tools, and editors far friendlier than vi(1) (but which i think vim has now surpassed) and many other good things that went away with near-standarization on Unix-like interfaces. I could permit a file to a specific user and say I wanted to give him append access only on Tues. from 5 to 7 PM on those old machines. ACLs are still not common in a lot of environments today. You could ask for last access and access counts to be kept on a file so you could tell who loaded a library file and how often, and when they last accessed it. That was really nice. We threw a few babies out with the bathwater by going away from proprietary OSes, even though that was a worthy goal. I can remember having to remember a dozen commands just to list files in a directory (CATLIST, DIR, …) and different commands for the same thing on CDC, PRIME, VAX, IBM, HP, AEGIS, … what a nightmare that was. Although I miss the system-language extensions Fortran had. VAX/VMS has Fortran long before C and the languages were extended to give you full access to the OS, which i remember as being better than most of the C/C++ interfaces available today, but they locked you into one OS. Fortran “owned” graphics, and the first relational database and regular expression parser I ever used or even heard about was in Fortran (RIM0; I have heard it still exists in a few places, but I have not seen it in years).
If such features had gone into the standard and not been fought against because of the work required or because it gave a vendor advantage or reduced vendor lock-in there would have been no need for dozens of the languages that came afterward.