From 509b3598f7ab3f7582bdee393f0890aa8271fbc9 Mon Sep 17 00:00:00 2001 From: axel Date: Wed, 18 Jan 2006 05:34:50 +1000 Subject: [PATCH] Make manual and completions reflect the facty that any combination od set_color params are valid values for $fish_color_* variables darcs-hash:20060117193450-ac50b-636c59494399d88151174ee28096d93c0bcdd16d.gz --- doc_src/doc.hdr | 14 +++++++++----- init/completions/set.fish | 23 ++++++++++++++--------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index 1ed335046..0a0b2d361 100644 --- a/doc_src/doc.hdr +++ b/doc_src/doc.hdr @@ -925,11 +925,15 @@ fish_color_substitution, \c fish_color_redirection, \c fish_color_end, \c fish_color_error, \c fish_color_param, \c fish_color_comment, \c fish_color_match, \c fish_color_search_match, \c fish_color_cwd, \c fish_pager_color_prefix, \c fish_pager_color_completion, \c -fish_pager_color_description and \c fish_pager_color_progress. Valid -values are \c black, \c red, \c green, \c brown, \c yellow, \c blue, -\c magenta, \c purple, \c cyan, \c white or \c normal. Setting one of -the above variables to normal will mean that the text color will be -set to the default foreground color for the terminal. +fish_pager_color_description and \c +fish_pager_color_progress. Usually, the value of these variables will +be one of \c black, \c red, \c green, \c brown, \c yellow, \c blue, \c +magenta, \c purple, \c cyan, \c white or \c normal, but they can be an +array containing any color options for the set_color command. + +Issuing set fish_color_error black --background=red +--bold will make all commandline errors be written in a black, +bold font, with a red background. \subsection prompt Programmable prompt diff --git a/init/completions/set.fish b/init/completions/set.fish index 6ad9a19c8..e2f14ae3d 100644 --- a/init/completions/set.fish +++ b/init/completions/set.fish @@ -58,20 +58,25 @@ 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") +# Regular switches, set only accepts these before the variable name, +# so we need to test using __fish_is_first_token -# Complete using preexisting variables +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 (_ "Make variable scope universal, i.e. share variable with all the users fish processes on this computer") +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 using preexisting variable names 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) +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') # Locale completions complete -c set -n '__fish_is_first_token' -x -a '$__fish_locale_vars' -d 'Locale variable'