From 5870ee77233783d3ed202b9154edf55b5c0581c5 Mon Sep 17 00:00:00 2001 From: liljencrantz Date: Sun, 30 Sep 2007 17:42:04 +1000 Subject: [PATCH] Add input function completions for the commandline builtin darcs-hash:20070930074204-75c98-670704072134326d281626dcc6c1e7dc5be66140.gz --- share/completions/commandline.fish | 1 + share/functions/__fish_commandline_test.fish | 23 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 share/functions/__fish_commandline_test.fish diff --git a/share/completions/commandline.fish b/share/completions/commandline.fish index b590b182a..c30b44132 100644 --- a/share/completions/commandline.fish +++ b/share/completions/commandline.fish @@ -16,3 +16,4 @@ complete -c commandline -s o -l tokenize --description "Print each token on a se complete -c commandline -s I -l input --description "Specify command to operate on" complete -c commandline -s C -l cursor --description "Set/get cursor position, not buffer contents" +complete -c commandline -n __fish_commandline_test -a '(bind --function-names)' -d 'Function name' -x diff --git a/share/functions/__fish_commandline_test.fish b/share/functions/__fish_commandline_test.fish new file mode 100644 index 000000000..af533eb2e --- /dev/null +++ b/share/functions/__fish_commandline_test.fish @@ -0,0 +1,23 @@ + +function __fish_commandline_test + +set -l is_function no +for i in (commandline -poc) + switch $i + case -f --f --fu --fun --func --funct --functi --functio --function + set is_function yes + + case -- + break + + + end +end + +switch $is_function + case yes + return 0 +end +return 1 + +end