- I'd like to write a zsh-completion script, which completes with files in a directory different from the current working directory. (I can archieve this, see below.)
- Additionally the user shall be able to use globbing on the completed command. How to archieve this?
Example:
Let's assume we want to complete a command called rumple
. rumple
takes a list of files from ~/rumple
as argument (possibly nested directories/files). A valid invocation may be:
rumple pumple romple/pample
Which means rumple
shall effectively work on ~/rumple/pumple
and ~/rumple/romple/pample
.
Now the zsh-completion script _rumple
for rumple could look like:
#compdef rumple
_path_files -W ~/rumple
This completes the first part of the task: rumple p<TAB>
will complete to rumple pumple
(assuming there are not other files in ~/rumple starting with 'p'). However the second part is not working. rumple **/p*
should complete to rumple pumple romple/pample
, even if the current working directory is not ~/rumple
.