Add Makefile --file detection to completion

This commit is contained in:
Daniel Beckwith
2018-03-20 11:20:10 -04:00
committed by ridiculousfish
parent 44e2c28255
commit 7583d57b63
2 changed files with 23 additions and 15 deletions

View File

@@ -1,11 +1,14 @@
# Completions for make
function __fish_complete_make_targets
set directory (string replace -r '^make .*(-C ?|--directory[= ]?)([^ ]*) .*$' '$2' -- $argv)
if test $status -eq 0 -a -d $directory
__fish_print_make_targets $directory
else
__fish_print_make_targets
set directory (string replace -r '^make .*(-C ?|--directory(=| +))([^ ]*) .*$' '$3' -- $argv)
if not test $status -eq 0 -a -d $directory
set directory ''
end
set file (string replace -r '^make .*(-f ?|--file(=| +))([^ ]*) .*$' '$3' -- $argv)
if not test $status -eq 0 -a -f $file
set file ''
end
__fish_print_make_targets "$directory" "$file"
end
# This completion reenables file completion on