2006-02-08 17:20:05 +08:00
|
|
|
#
|
|
|
|
# Find directories that complete $argv[1], output them as completions
|
|
|
|
# with description $argv[2] if defined, otherwise use 'Directory'
|
|
|
|
#
|
2017-04-11 11:40:25 +08:00
|
|
|
function __fish_complete_directories -d "Complete directory prefixes" --argument comp desc
|
|
|
|
if not set -q desc[1]
|
2017-06-03 11:40:58 +08:00
|
|
|
set desc (_ "Directory")
|
2016-11-28 13:27:22 +08:00
|
|
|
end
|
2006-02-08 17:20:05 +08:00
|
|
|
|
2017-04-11 11:40:25 +08:00
|
|
|
set -l dirs $comp*/
|
|
|
|
if set -q dirs[1]
|
2016-11-28 13:27:22 +08:00
|
|
|
printf "%s\t$desc\n" $dirs
|
|
|
|
end
|
2006-02-08 17:20:05 +08:00
|
|
|
end
|