I would like to add a custom completion spec for bash's Programmable Completion that does the following: whenever the command entered is foo
, I would like to do filename/directory completion for the partial token after foo
, but relative to a fixed directory (say /a/b/c
) rather than the current working directory.
For example, suppose /a/b/c
contains the files
hello goodbye cheers directory
and /a/b/c/directory
contains the files
adieu ciao
Then, typing foo go<TAB>
should complete go
to goodbye
, and typing foo dir<TAB>ci<TAB>
should complete the argument first to directory/
and then to directory/ciao
, regardless of what my current working directory is.
I was hoping to be able to set this up with just a single call to complete
, but after reading the manual, it doesn't appear that I can do this. Can it be done? And, if not, how could I add a compspec to do this?