0

我有 2 个包含文件夹的文件夹

/me/foo/: 
  a/
  b/
  c/

/me/bar/:
  c/
  d/
  e/

我想为命令创建完成功能,baz以便

$ baz [tab]

给出完成参数如下

a b c d e

注意重复c只写了一次,它不包括斜杠。

我知道如何完成,_files但这只会给我来自单个目录的文件。

我怎么做?

4

1 回答 1

0

我发现这对我有用

local services
services=$(ls -d /me/foo/*/ /me/bar/*/ | xargs basename| uniq)
_alternative "dirs:some directories:($services)"
于 2016-04-07T17:55:14.210 回答