`ShellComp::File` not working as expected on bash
ozwaldorf opened this issue · 6 comments
Installing completions for lutgen fe4450 which uses the file mask to eliminate non images:
*.avif|*.bmp|*.dds|*.exr|*.ff|*.gif|*.hdr|*.ico|*.jpg|*.jpeg|*.png|*.pnm|*.qoi|*.tga|*.tiff|*.webp
fails to work as expected on bash (hitting tab after some
):
compared to the correct suggestion by zsh:
If needed, I can add a standalone example to reproduce the issue
I've seen your code, will try to reproduce it myself. Let's see what I can do about bash not cooperating :)
I was able to use !*.@(png|jpg|...)
which still worked in zsh, but bash would show the current directories files and seemed to ignore what was typed. At least a little closer to expected behavior, but still not quite
Hopefully will have a chance to look at it today. I have a general idea of what is going wrong, just need to look up the docs and change it to generate correctly escaped stuff.
after some experiments managed to produce this manually and it seem to work.
Looks like key part for _filedir
is having first two lines - local and initialization. So emitting those in addition to _filedir
for bash should do the trick. Will try to write some of that tomorrow-ish.
_de()
{
local cur prev words cword
_init_completion || return
_filedir '@(md|toml)'
}
complete -F _de de
_dr()
{
local cur prev words cword
_init_completion || return
_filedir md
}
complete -F _dr dr
_dw()
{
local cur prev words cword
_init_completion || return
_filedir
}
complete -F _dw dw
(I have something that works locally, will try to push a branch today)