aboutsummaryrefslogtreecommitdiffhomepage
path: root/init
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-01-17 01:01:10 +1000
committerGravatar axel <axel@liljencrantz.se>2006-01-17 01:01:10 +1000
commit5bd66ee2ceea3256bf0dc71100e5db9071e65120 (patch)
treea15c0bdfc99ee6a7c220fd8c5f8e2bf9cc87d890 /init
parente593f9be532dec033bc2e28e8cc74320b1b6ec2f (diff)
Add a __fish_complete_command function for completing using a command name. Change name of the __fish_set_is_first to __fish_is_first_token and move it to the common completion util file
darcs-hash:20060116150110-ac50b-d864b516887c8fae941a745186dc308d50113c23.gz
Diffstat (limited to 'init')
-rw-r--r--init/completions/set.fish20
-rw-r--r--init/fish_complete.fish.in19
2 files changed, 22 insertions, 17 deletions
diff --git a/init/completions/set.fish b/init/completions/set.fish
index 4ca20140..6ad9a19c 100644
--- a/init/completions/set.fish
+++ b/init/completions/set.fish
@@ -15,23 +15,9 @@ complete -y set_color
set -g __fish_locale_vars LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
#
-# Verious helper functions
+# Various helper functions
#
-function __fish_set_is_first -d 'Test if no non-switch argument has been specified yet'
- set -- cmd (commandline -poc)
- set -e -- cmd[1]
- for i in $cmd
- switch $i
- case '-*'
-
- case '*'
- return 1;
- end
- end
- return 0
-end
-
function __fish_set_is_color -d 'Test if We are specifying a color value for the prompt'
set cmd (commandline -poc)
set -e cmd[1]
@@ -82,11 +68,11 @@ complete -c set -s q -l query -d (_ "Test if variable is defined")
complete -c set -s h -l help -d (_ "Display help and exit")
# Complete using preexisting variables
-complete -c set -n '__fish_set_is_first' -x -a "(set|sed -e 's/ /\tVariable: /')"
+complete -c set -n '__fish_is_first_token' -x -a "(set|sed -e 's/ /\tVariable: /')"
# Color completions
complete -c set -n '__fish_set_is_color' -x -a '(set_color --print-colors)' -d (_ Color)
# Locale completions
-complete -c set -n '__fish_set_is_first' -x -a '$__fish_locale_vars' -d 'Locale variable'
+complete -c set -n '__fish_is_first_token' -x -a '$__fish_locale_vars' -d 'Locale variable'
complete -c set -n '__fish_set_is_locale' -x -a '(locale -a)' -d (_ Locale)
diff --git a/init/fish_complete.fish.in b/init/fish_complete.fish.in
index 9c15be7e..f752040c 100644
--- a/init/fish_complete.fish.in
+++ b/init/fish_complete.fish.in
@@ -95,6 +95,11 @@ function __fish_complete_pids -d "Print a list of process identifiers along with
# pgrep -l -v -P %self | sed 's/ /\t/'
end
+function __fish_complete_command -d "Complete using all available commands"
+ for i in $PATH; command ls $i; end
+end
+
+
function __fish_print_hostnames -d "Print a list of known hostnames"
# Print all hosts from /etc/hosts
@@ -266,6 +271,20 @@ function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the lon
end
+function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet'
+ set -- cmd (commandline -poc)
+ set -e -- cmd[1]
+ for i in $cmd
+ switch $i
+ case '-*'
+
+ case '*'
+ return 1;
+ end
+ end
+ return 0
+end
+
#
# Completions for SysV startup scripts
#