Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Doing useful things in completers
- X-seq: zsh-workers 49252
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Doing useful things in completers
- Date: Fri, 6 Aug 2021 06:43:20 +0200
- Archived-at: <https://zsh.org/workers/49252>
- List-id: <zsh-workers.zsh.org>
This came up on irc, someone was complaining that file completion
didn't work, turns out the situation they were trying was: mysql
--ssl-ca=/home/<tab>
The _mysql completer just feeps with
---- no match for: `MySQL database', `option', or `corrections'
and the completer code looks like this:
_mysql() {
_arguments -s \
"$_mysql_common_opts[@]" "$_mysql_variables_opts[@]" \
'(--disable-auto-rehash)--auto-rehash[enable automatic rehashing]' \
...other options elided...
'(--auto-rehash)--disable-auto-rehash[disable automatic hashing]' \
'(-G --named-commands)--disable-named-commands' \
':MySQL database:_mysql_databases'
}
The completer itself hasn't been updated since 2004, and of course we
could add all new options etc to it (and probably should), but I'm
curious if there's some handy way you can rewrite this so that file
completion would be tried for unknown options here (eg, the user
already typed the full option name including the trailing equal sign)?
Nothing comes to mind but I'm not as familiar with completion
intricacies these days...
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author