Closed ozwaldorf closed 4 weeks ago
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
Doing some more digging, even just using ShellComp::File { mask: None }
ignores whatever prefix the user typed as well, and only suggests things in the current directory
bash only showing current dir:
vs zsh working as expected:
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)
Installing completions for lutgen fe4450 which uses the file mask to eliminate non images:
fails to work as expected on bash (hitting tab after![image](https://github.com/user-attachments/assets/0d43c39e-b945-462e-9d8c-0010a5b31a33)
some
):compared to the correct suggestion by zsh:![image](https://github.com/user-attachments/assets/06c3e766-4b99-415d-a40e-3d5c7808853f)
If needed, I can add a standalone example to reproduce the issue