2006-01-16 04:03:03 +08:00
|
|
|
#
|
|
|
|
# Completions for the 'set' builtin
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# We depend on set_color completions for color definitions
|
|
|
|
#
|
2005-09-20 21:31:55 +08:00
|
|
|
|
|
|
|
complete -y set_color
|
|
|
|
|
2006-01-16 04:03:03 +08:00
|
|
|
#
|
|
|
|
# All locale variables used by set completions
|
|
|
|
#
|
|
|
|
|
|
|
|
set -g __fish_locale_vars LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
|
|
|
|
|
|
|
|
#
|
2006-01-16 23:01:10 +08:00
|
|
|
# Various helper functions
|
2006-01-16 04:03:03 +08:00
|
|
|
#
|
2005-09-20 21:31:55 +08:00
|
|
|
|
|
|
|
function __fish_set_is_color -d 'Test if We are specifying a color value for the prompt'
|
2006-01-16 04:03:03 +08:00
|
|
|
set cmd (commandline -poc)
|
|
|
|
set -e cmd[1]
|
2005-09-20 21:31:55 +08:00
|
|
|
for i in $cmd
|
|
|
|
switch $i
|
|
|
|
|
|
|
|
case 'fish_color_*' 'fish_pager_color_*'
|
|
|
|
return 0
|
|
|
|
|
|
|
|
case '-*'
|
|
|
|
|
|
|
|
case '*'
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
end
|
2006-01-16 04:03:03 +08:00
|
|
|
return 1
|
2005-09-20 21:31:55 +08:00
|
|
|
end
|
|
|
|
|
2006-01-16 04:03:03 +08:00
|
|
|
function __fish_set_is_locale -d 'Test if We are specifying a locale value for the prompt'
|
|
|
|
set cmd (commandline -poc)
|
|
|
|
set -e cmd[1]
|
|
|
|
for i in $cmd
|
|
|
|
switch $i
|
|
|
|
|
|
|
|
case $__fish_locale_vars
|
|
|
|
return 0
|
|
|
|
|
|
|
|
case '-*'
|
|
|
|
|
|
|
|
case '*'
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Completions
|
|
|
|
#
|
|
|
|
|
|
|
|
complete -c set -s e -l erase -d (_ "Erase variable")
|
|
|
|
complete -c set -s x -l export -d (_ "Export variable to subprocess")
|
|
|
|
complete -c set -s u -l unexport -d (_ "Do not export variable to subprocess")
|
|
|
|
complete -c set -s g -l global -d (_ "Make variable scope global")
|
|
|
|
complete -c set -s l -l local -d (_ "Make variable scope local")
|
|
|
|
complete -c set -s U -l universal -d (_ "Make variable scope universal, i.e. share variable with all the users fish processes on this computer")
|
|
|
|
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
|
2006-01-16 23:01:10 +08:00
|
|
|
complete -c set -n '__fish_is_first_token' -x -a "(set|sed -e 's/ /\tVariable: /')"
|
2006-01-16 04:03:03 +08:00
|
|
|
|
|
|
|
# Color completions
|
2006-01-08 10:56:56 +08:00
|
|
|
complete -c set -n '__fish_set_is_color' -x -a '(set_color --print-colors)' -d (_ Color)
|
2006-01-16 04:03:03 +08:00
|
|
|
|
|
|
|
# Locale completions
|
2006-01-16 23:01:10 +08:00
|
|
|
complete -c set -n '__fish_is_first_token' -x -a '$__fish_locale_vars' -d 'Locale variable'
|
2006-01-16 04:03:03 +08:00
|
|
|
complete -c set -n '__fish_set_is_locale' -x -a '(locale -a)' -d (_ Locale)
|