Add minor new completion for make command

darcs-hash:20060825154516-ac50b-80284df4f7dd6cd332f2b21f5c9bdc359cc00eca.gz
This commit is contained in:
axel 2006-08-26 01:45:16 +10:00
parent 97c3e231f4
commit 046dd82995

View file

@ -1,10 +1,19 @@
#Completions for make
# Completions for make
function __fish_print_make_targets
set files Makefile makefile GNUmakefile
grep -h -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $files | cut -d ":" -f 1 | sed -e 's/^ *//;s/ *$//;s/ */\n/g' ^/dev/null
end
# This completion is a bit ugly. It reenables file completion on
# assignments, so e.g. 'make foo FILES=<tab>' will recive standard
# filename completion. Unfortunatly, this turns out to be a bit
# complicated to do.
set -l is_assignment "commandline -ct|grep '..*='"
set -l complete_file_assignment '(commandline -ct)(complete --do-complete=this_command_does_not_exist\ (commandline -ct|sed -e \'s/.*=//\'))'
complete -c make --condition $is_assignment -a $complete_file_assignment
complete -x -c make -a "(__fish_print_make_targets)" -d (N_ "Target")
complete -r -c make -s f -d (N_ "Use file as makefile") -r
complete -x -c make -s C -x -a "(__fish_complete_directory (commandline -ct))" -d (N_ "Change directory")