Ralph Corderoy <ralph(_at_)inputplus(_dot_)co(_dot_)uk> writes:
I did work out the tcsh(1) spell for that in another millenium, these
days I use bash as it's what to hand. I've had a go at what you
requested and it seems to work; I don't use it myself and haven't tried
to define a bash completion before so be warned.
This has been on my list of things to work out how to do for
years; thanks for saving me the trouble!
comp_nmh_folder()
{
local w=${COMP_WORDS[COMP_CWORD]} &&
[[ $w == +* ]] && w=${w#+} &&
COMPREPLY=($(
folders -fast |
If you have the sort of folder structure I do, that wants to be
folders -fast -recurse |
awk -v "w=$w" -v "l=${#w}" 'substr($0, 1, l) == w'
))
}
complete -P + -F comp_nmh_folder -D
--
Jón Fairbairn
Jon(_dot_)Fairbairn(_at_)cl(_dot_)cam(_dot_)ac(_dot_)uk
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers