What is the format for the -F option of _path_files and compadd?

I'm passing several directories to _path_files:

_path_files -W "($base_directories)" -/

But some of those directory trees I don't want to complete for this particular command.

The documentation I can find for _path_files says it accepts a -F option—just like compadd, but I can't find the format to pass them in.

Twiddling around hasn't been very fruitful either.

I've tried, for example,

_path_files -W "($base_directories)" -/ -F shared; # shared still shows up
_path_files -W "($base_directories)" -/ -F "(shared)"; # barfs on that guy

That looks correct if you want to ignore shared at the root of the directory tree, i.e. if you're ignoring one of the $base_directories. But if you meant to ignore shared somewhere deeper in the hierarchy, you need -F "(shared **shared)". You can also put the patterns in an array, which will reduce the quoting pains.

local -a ignored base_directories
ignored=(shared '*/shared')
_path_files -W base_directories -/ -F ignored

There are examples in the standard distribution in _cvs and _darcs.

If this doesn't help, try investigating what's going on by adding set -x and set +x around the problematic code, or setopt local_options xtrace (a.k.a set -x and change options only for the duration of the current function).

  • hmmm. I thought I had tried all that. but it worked! thanks! – Michael Deardeuff Jun 6 '11 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.