I've often thought it a mistake to have main() be the only entry point. There's a simple elegance in that, I'll grant, but if there were a parse_args() entry point that also allowed for completion that was called before main, and that you'd only proceed to main on a complete command line, you could easily put the burdon of command line completion into the programs. They know that arg3 is a filename or a sub command or a network interface or an alternate name of cthulhu. tcsh does command completion, but in a half-assed, gotta know about all the commands and have a giant table that duplicates all the programs in the system's parsers, which isn't scalable. It's had that since this 80's as has bash, and both have been lame equally as long. It would also let the program do 'noise words' like TOPS-20 did w/o having to actually parse them...
clang --complete is an interesting variation on my ideas within the realm of doing non-standard weird things and starts to place the burden of knowledge on the program itself, which is more in line with the thinking of Unix and the main stream of OOish thought we've know about since the early 70s with smalltalk and other such pioneering things.
Then again, maybe my idea is too much influenced by TOPS-20 commands that became resident to do command completion, then ran more quickly because they were already at least half-loaded when the user hit return.
Warner