aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-08-26 01:45:16 +1000
committerGravatar axel <axel@liljencrantz.se>2006-08-26 01:45:16 +1000
commit046dd82995690358bc119483d0b8681bd7b40058 (patch)
tree3fe56d6683aa61e43dc0e6734b9411e705efde09 /share
parent97c3e231f49414071ed48a6090a972e443124457 (diff)
Add minor new completion for make command
darcs-hash:20060825154516-ac50b-80284df4f7dd6cd332f2b21f5c9bdc359cc00eca.gz
Diffstat (limited to 'share')
-rw-r--r--share/completions/make.fish11
1 files changed, 10 insertions, 1 deletions
diff --git a/share/completions/make.fish b/share/completions/make.fish
index 53dd7eb7..832524cf 100644
--- a/share/completions/make.fish
+++ b/share/completions/make.fish
@@ -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")