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
/a/b/c/directory contains the files
foo go<TAB> should complete
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?