2006-01-16 04:03:03 +08:00
|
|
|
#
|
|
|
|
# Completions for the 'set' builtin
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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 '-*'
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2005-09-20 21:31:55 +08:00
|
|
|
case '*'
|
|
|
|
return 1
|
|
|
|
end
|
2010-09-18 10:18:26 +08:00
|
|
|
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 '-*'
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2006-01-16 04:03:03 +08:00
|
|
|
case '*'
|
|
|
|
return 1
|
|
|
|
end
|
2010-09-18 10:18:26 +08:00
|
|
|
end
|
2006-01-16 04:03:03 +08:00
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Completions
|
|
|
|
#
|
|
|
|
|
2006-01-18 03:34:50 +08:00
|
|
|
# Regular switches, set only accepts these before the variable name,
|
|
|
|
# so we need to test using __fish_is_first_token
|
|
|
|
|
2017-10-12 01:17:35 +08:00
|
|
|
complete -c set -n '__fish_is_first_token' -s e -l erase -d "Erase variable"
|
|
|
|
complete -c set -n '__fish_is_first_token' -s x -l export -d "Export variable to subprocess"
|
|
|
|
complete -c set -n '__fish_is_first_token' -s u -l unexport -d "Do not export variable to subprocess"
|
|
|
|
complete -c set -n '__fish_is_first_token' -s g -l global -d "Make variable scope global"
|
|
|
|
complete -c set -n '__fish_is_first_token' -s l -l local -d "Make variable scope local"
|
|
|
|
complete -c set -n '__fish_is_first_token' -s U -l universal -d "Share variable persistently across sessions"
|
|
|
|
complete -c set -n '__fish_is_first_token' -s q -l query -d "Test if variable is defined"
|
|
|
|
complete -c set -n '__fish_is_first_token' -s h -l help -d "Display help and exit"
|
|
|
|
complete -c set -n '__fish_is_first_token' -s n -l names -d "List the names of the variables, but not their value"
|
2006-08-31 23:44:00 +08:00
|
|
|
|
2006-01-18 03:34:50 +08:00
|
|
|
|
|
|
|
# Complete using preexisting variable names
|
2006-03-02 19:28:08 +08:00
|
|
|
complete -c set -n '__fish_is_first_token' -x -a "(set|sed -e 's/ /'\t'Variable: /')"
|
2006-01-16 04:03:03 +08:00
|
|
|
|
|
|
|
# Color completions
|
2017-10-12 01:17:35 +08:00
|
|
|
complete -c set -n '__fish_set_is_color' -x -a '(set_color --print-colors)' -d Color
|
|
|
|
complete -c set -n '__fish_set_is_color' -s b -l background -x -a '(set_color --print-colors)' -d "Change background color"
|
|
|
|
complete -c set -n '__fish_set_is_color' -s o -l bold -d 'Make font bold'
|
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'
|
2017-06-03 11:40:58 +08:00
|
|
|
complete -c set -n '__fish_set_is_locale' -x -a '(locale -a)' -d (_ "Locale")
|
2012-08-24 21:06:02 +08:00
|
|
|
complete -c set -s L -l long -d 'Do not truncate long lines'
|