Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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
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).

share|improve this answer
    
hmmm. I thought I had tried all that. but it worked! thanks! –  Michael Deardeuff Jun 6 '11 at 17:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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