complgen should support completing file name arguments. It should be possible to specify in the grammar which positional arguments are to be completed as a file name.
Each shell seems be doing it differently and we need to be frugal in weeding through the file system as we may easily freeze the shell for seconds.
Bash
compgen -f -- <PREFIX> (or compgen -A file) prints results on stdout so it’s easily integrated into complgen
Zsh
There are _files and _path_files bulitins that implicitly invoke compadd (AFAIU) so we can’t treat it as another command invoked via { … }. This case needs special handling.
Interpreter mode (JIT)
In order to respect shell completion settings (like whether to expand completions like * for instance), it should actually shell out to list files
complgen
should support completing file name arguments. It should be possible to specify in the grammar which positional arguments are to be completed as a file name.Each shell seems be doing it differently and we need to be frugal in weeding through the file system as we may easily freeze the shell for seconds.
compgen -f -- <PREFIX>
(orcompgen -A file
) prints results on stdout so it’s easily integrated intocomplgen
__fish_complete_path <PREFIX> <DESCRIPTION>
prints results on stdout so it’s easily integrated intocomplgen
_files
and_path_files
bulitins that implicitly invokecompadd
(AFAIU) so we can’t treat it as another command invoked via{ … }
. This case needs special handling.*
for instance), it should actually shell out to list files