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