On Fri, Jan 17, 2020 at 10:41:30PM +0000, Uwe Werler wrote: > On 17 Jan 22:32, Ottavio Caruso wrote: > > On Fri, 17 Jan 2020 at 22:03, Uwe Werler <uwe.wer...@retiolum.eu> wrote: > > > > > > Hi misc, > > > > > > I use heavily the feature to set command completion in ksh. Unfortunately > > > this doesn't work for commands with "-" (like ssh-add, salt-call etc.) in > > > command name because the parameter name for the array is invalid. > > > > I'm not sure if I'm getting what you're saying. I have a barebone > > plain-vanilla OpenBSD 6.6 installation and I have ksh as my login > > shell. I can do command and file completion with [TAB] on any commands > > with a hyphen (pkg-config, ssh-add, ssh-agent, ssh-keygen, ssh-keyscan > > and so on). > > >From man 1 ksh: > > Custom completions may be configured by creating an array named > ‘complete_command’, optionally suffixed with an argument number > to complete only for a single argument. So defining an array > named ‘complete_kill’ provides possible completions for any > argument to the kill(1) command, but ‘complete_kill_1’ only > completes the first argument. For example, the following command > makes ksh offer a selection of signal names for the first > argument to kill(1): > > set -A complete_kill_1 -- -9 -HUP -INFO -KILL -TERM > > This of course can't work for commands with a hyphen because the parameter > name > of the array is then invalid. > > Uwe
A somewhat ugly workaround would be to define aliases for the commands that you want te install these completions for. The aliases would have no dashes in their names. alias ssh_add=ssh-add set -A complete_ssh_add_1 -- -D -l -L -v -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .