fish: snazzy border for fish_vars and fish_colors

This commit is contained in:
Charles Gould 2021-02-11 22:20:00 -05:00
parent 3a5b050993
commit 3c75058dd8
2 changed files with 11 additions and 10 deletions

View File

@ -14,18 +14,19 @@ function fish_colors --description 'Print the fish color variables'
set -l normal (set_color normal)
set -l bold (set_color --bold)
printf "\n| %-32s | %-38s | %-22s |\n" Variable Definition Example
echo '|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|'
echo '┌──────────────────────────────────┬────────────────────────────────────────┬────────────────────────┐'
echo '│ Variable │ Definition │ Example │'
echo '├──────────────────────────────────┼────────────────────────────────────────┼────────────────────────┤'
for variable in $color_list
set -l value $$variable
set -l color (set_color $value 2>/dev/null)
or begin
printf "| %-32s | %s%-38s | %-22s |\n" "$variable" (set_color --bold white --background=red) "$value" "The quick brown fox..."
printf "│ %-32s │ %s%-38s │ %-22s │\n" "$variable" (set_color --bold white --background=red) "$value" "The quick brown fox..."
continue
end
printf "| $normal%-32s | $bold%-38s$normal | $color%-22s$normal |\n" "$variable" "$value" "The quick brown fox..."
printf "$normal%-32s │ $bold%-38s$normal$color%-22s$normal\n" "$variable" "$value" "The quick brown fox..."
end
echo '|__________________________________|________________________________________|________________________|'\n
echo '└──────────────────────────────────┴────────────────────────────────────────┴────────────────────────┘'
end
if contains -- '-g' $argv; or contains -- '--global' $argv

View File

@ -1,11 +1,11 @@
function fish_vars
set -l _special_variables BROWSER CDPATH LANG PATH SHLVL fish_ambiguous_width fish_emoji_width fish_escape_delay_ms fish_trace fish_user_paths hostname umask version
set -l _path_variables CDPATH PATH fish_user_paths
set -l _table_format "| %-24s | %-38s |\n"
set -l _table_format "│ %-24s │ %-60s │\n"
printf "\n$_table_format" Variable Value
printf $_table_format (printf "%.s¯" (seq 24)) (printf "%.s¯" (seq 38))
echo '┌──────────────────────────┬──────────────────────────────────────────────────────────────┐'
echo '│ Variable │ Value │'
echo '├──────────────────────────┼──────────────────────────────────────────────────────────────┤'
for variable in $_special_variables
if set -q $variable
@ -23,6 +23,6 @@ function fish_vars
end
end
printf $_table_format (printf "%.s_" (seq 24)) (printf "%.s_" (seq 38))
echo '└──────────────────────────┴──────────────────────────────────────────────────────────────┘'
end