4 ms·
Completion scripts from bash are far too much of a kludge to extract information from. Most tools are written in C, and the standard way to parse options in C
by mtdewcmu 13y ago
Completion scripts from bash are far too much of a kludge to extract information from.
Most tools are written in C, and the standard way to parse options in C is with getopt(3) or getopt_long(3). I actually looked into searching the compiled binary for the getopt_long structure, but that wasn't so easy. Since these functions have information on all the possible options, it would be nice if there was a standard way to get them to spit out the option list.*
See my reply to your comment in another thread. It would be a killer app to have better autocomplete support, but I can't offer assurance that it's feasible.
* I had another idea: you could use ELF tricks (LD_PRELOAD) to load a different version of getopt/getopt_long that would spit out the specifications.