Open Freed-Wu opened 1 year ago
I think the best way to do this is to make rlwrap
s help text conform to the GNU tools format. In that way I can leave the job to the different automated tools that exist for bash
, zsh
and possibly other shells
_gnu_generic
needs zsh to parse the help text which is slower than the pre-generated shell completion script. However, a standard help text is also a good change.
https://github.com/hanslub42/rlwrap/blob/master/src/main.c#L125-L161 define a stuct to store the information of options, I thought the program can use this options to generate help text from a template. If so, any one can do the similar work to generate shell completion script from a template by this sturct. However, it looks this program only use this struct for getopt. https://github.com/hanslub42/rlwrap/blob/master/src/utils.c#L716-L748 rewrite code to print help text. Perhaps move these two parts about option information to one part will be more convenient to maintain and debug? (When an option is changed, don't need to change two parts). Just my 2c. And the code has some trailing whitespaces which I think can be removed.
Is it possible that rlwrap provide tab completion for common shells like
An example for zsh
/usr/share/zsh/site-functions/_rlwrap
This file can be generated automatically from https://github.com/hanslub42/rlwrap/blob/master/src/main.c#L125-L161
TIA!