fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
e2b18fc5b
master
1# RUN: %fish %s 2# REQUIRES: command -v diff 3 4fish_config theme choose default 5 6set -g fish( status fish-path) 7 8fish_config prompt list| string match -r'^(?:acidhub|disco|nim)$' 9# CHECK: acidhub 10# CHECK: disco 11# CHECK: nim 12 13diff \ 14( fish_config prompt list| psub -s config-prompt-list) \ 15( fish_config prompt| psub -s config-prompt) 16 17fish_config prompt show non-existent-prompt 18 19fish_config prompt show default 20# CHECK: {{\x1b\[4m}}default{{\x1b\[m}} 21# CHECK: {{.*}}@{{.*}}>{{.*}} 22 23type fish_mode_prompt 24# CHECK: fish_mode_prompt is a function with definition 25# CHECK: # Defined in {{.*}}functions/fish_mode_prompt.fish @ line 2 26# CHECK: function fish_mode_prompt --description 'Displays the current mode' 27# CHECK: # {{.*}} 28# CHECK: fish_default_mode_prompt 29# CHECK: end 30 31function set-all-the-prompts 32function fish_prompt 33echo left-prompt 34end 35function fish_right_prompt 36echo right-prompt 37end 38function fish_mode_prompt 39echo mode-prompt 40end 41end 42 43set-all-the-prompts 44echo yes| fish_config prompt save> /dev/null 45grep '\S' $__fish_config_dir /functions/{ fish_prompt, fish_right_prompt, fish_mode_prompt} .fish 46# CHECK: {{.*}}/functions/fish_prompt.fish:function fish_prompt 47# CHECK: {{.*}}/functions/fish_prompt.fish: echo left-prompt 48# CHECK: {{.*}}/functions/fish_prompt.fish:end 49# CHECK: {{.*}}/functions/fish_right_prompt.fish:function fish_right_prompt 50# CHECK: {{.*}}/functions/fish_right_prompt.fish: echo right-prompt 51# CHECK: {{.*}}/functions/fish_right_prompt.fish:end 52# CHECK: {{.*}}/functions/fish_mode_prompt.fish:function fish_mode_prompt 53# CHECK: {{.*}}/functions/fish_mode_prompt.fish: echo mode-prompt 54# CHECK: {{.*}}/functions/fish_mode_prompt.fish:end 55 56echo yes| fish_config prompt save nim> /dev/null 57grep -q nim@Hattori$__fish_config_dir /functions/fish_prompt.fish|| 58echo 'failed to save prompt?' 59not path is$__fish_config_dir /functions/fish_right_prompt.fish 60or echo "fish_right_prompt.fish ought to be deleted" 61cat $__fish_config_dir /functions/fish_mode_prompt.fish 62# CHECK: function fish_mode_prompt 63# CHECK: end 64 65fish_config prompt choose nim 66type fish_prompt fish_right_prompt fish_mode_prompt| 67grep -EA1'^function.*|.*\[nim@Hattori:~\].*' 68# CHECK: function fish_prompt 69# CHECK: # This prompt shows: 70# CHECK: -- 71# CHECK: # ┬─[nim@Hattori:~]─[11:39:00] 72# CHECK: # ╰─>$ echo here 73# CHECK: -- 74# CHECKERR: type: Could not find 'fish_right_prompt' 75# CHECK: function fish_mode_prompt 76# CHECK: 77 78fish_config prompt choose disco 79type fish_prompt fish_right_prompt fish_mode_prompt| 80grep -EA1'^function.*|.*cksum$' 81# CHECK: function fish_prompt 82# CHECK: set -l last_status $status 83# CHECK: -- 84# CHECK: if command -sq cksum 85# CHECK: # randomized cwd color 86# CHECK: -- 87# CHECK: function fish_right_prompt 88# CHECK: set -g __fish_git_prompt_showdirtystate 1 89# CHECK: -- 90# CHECK: function fish_mode_prompt {{.*}} 91# CHECK: # {{.*}} 92 93fish_config prompt choose default 94type fish_prompt fish_right_prompt fish_mode_prompt| 95grep '^function' -A1 96# CHECK: function fish_prompt --description 'Write out the prompt' 97# CHECK: set -l last_pipestatus $pipestatus 98# CHECKERR: type: Could not find 'fish_right_prompt' 99# CHECK: -- 100# CHECK: function fish_mode_prompt {{.*}} 101# CHECK: # {{.*}} 102 103type fish_mode_prompt 104# CHECK: fish_mode_prompt is a function with definition 105# CHECK: # Defined {{in .*/functions/fish_mode_prompt.fish @ line 2|via `source`}} 106# CHECK: function fish_mode_prompt --description 'Displays the current mode' 107# CHECK: # {{.*}} 108# CHECK: fish_default_mode_prompt 109# CHECK: end 110 111fish_config theme choose non-existent-theme1 112# CHECKERR: No such theme: non-existent-theme1 113# CHECKERR: Searched {{/\S* (/\S*|and `status list-files themes`)}} 114 115# This still demos the current theme. 116fish_config theme show non-existent-theme2 117# CHECK: {{\x1b\[m}}{{\x1b\[4m}}Current{{\x1b\[m}} 118# CHECK: {{\x1b\[m/bright/vixens\x1b\[m \x1b\[36mjump\x1b\[m.*}} 119# CHECK: {{.*}} 120# CHECK: {{.*}} 121 122diff \ 123( fish_config theme list| psub -s config-theme-list) \ 124( fish_config theme| psub -s config-theme) 125 126fish_config theme list| string match -r\ 127'^(?:ayu|base16-default|coolbeans|default|none|'\ 128'tomorrow-night-bright|tomorrow)$' 129# CHECK: ayu 130# CHECK: base16-default 131# CHECK: coolbeans 132# CHECK: default 133# CHECK: none 134# CHECK: tomorrow-night-bright 135# CHECK: tomorrow 136 137fish_config theme show default-rgb 138# CHECK: {{\x1b\[m}}{{\x1b\[4m}}Current{{\x1b\[m}} 139# CHECK: {{\x1b\[m/bright/vixens\x1b\[m \x1b\[36mjump\x1b\[m.*}} 140# CHECK: {{\x1b\[m}}{{\x1b\[m}}echo{{\x1b\[m}} {{\x1b\[91m}}'{{\x1b\[33m}}Errors are the portal to discovery 141# CHECK: {{\x1b\[m}}{{\x1b\[m}}Th{{\x1b\[m}}{{\x1b\[90m}}is an autosuggestion 142 143# CHECK: {{\x1b\[m\x1b\[4mdefault-rgb \(light color theme\)\x1b\[m}} 144# CHECK: {{\x1b\[38;2;0;0;238m/bright/vixens\x1b\[m \x1b\[38;2;0;160;160mjump\x1b.*}} 145# CHECK: {{.*}} 146# CHECK: {{.*}} 147# CHECK: {{\x1b\[m\x1b\[4mdefault-rgb \(dark color theme\)\x1b\[m}} 148# CHECK: {{\x1b\[38;2;92;92;255m.*}} 149# CHECK: {{.*}} 150# CHECK: {{.*}} 151# CHECK: {{\x1b\[m\x1b\[4mdefault-rgb \(unknown color theme\)\x1b\[m}} 152# CHECK: {{\x1b\[m/bright/vixens\x1b\[m \x1b\[36mjump\x1b\[m.*}} 153# CHECK: {{.*}} 154# CHECK: {{.*}} 155 156fish_config theme show ayu| string match -r'^.*ayu.*' 157# CHECK: {{\x1b\[m}}{{\x1b\[4m}}ayu (light color theme){{\x1b\[m}} 158# CHECK: {{\x1b\[m}}{{\x1b\[4m}}ayu (dark color theme){{\x1b\[m}} 159 160mkdir $__fish_config_dir /themes 161touch $__fish_config_dir /themes/custom-from-userconf.theme 162fish_config theme show| grep -E'default-rgb|base16-default|custom-from-userconf' 163# CHECK: {{.*}}default-rgb (light color theme){{\x1b\[m}} 164# CHECK: {{.*}}default-rgb (dark color theme){{\x1b\[m}} 165# CHECK: {{.*}}default-rgb (unknown color theme){{\x1b\[m}} 166# CHECK: {{.*}}custom-from-userconf (unknown color theme){{\x1b\[m}} 167# CHECK: {{.*}}base16-default (light color theme){{\x1b\[m}} 168# CHECK: {{.*}}base16-default (dark color theme){{\x1b\[m}} 169 170# Override the default theme with different colors. 171status get-file themes/none.theme> $__fish_config_dir /themes/default.theme 172fish_config theme show default ayu| grep -E'default|ayu.*dark' -A1 173# CHECK: {{\x1b\[m}}{{\x1b\[4m}}default (unknown color theme){{\x1b\[m}} 174# CHECK: /bright/vixens{{.*}} 175# CHECK: -- 176# CHECK: {{\x1b\[m}}{{\x1b\[4m}}ayu (dark color theme){{\x1b\[m}} 177# CHECK: {{.*}}/bright/vixens{{.*}} 178 179function print-sample-colors 180echo "normal= $fish_color_normal " 181echo "autosuggestion= $fish_color_autosuggestion " 182end 183echo > $__fish_config_dir /themes/custom-from-userconf.theme\ 184"fish_color_normal yellow" 185 186{ 187 print-sample-colors 188 # CHECK: normal=--reset --theme=default 189 # CHECK: autosuggestion=brblack --theme=default 190 191 fish_config theme choose custom-from-userconf --color-theme=unknown 192 print-sample-colors 193 # CHECK: normal=yellow --theme=custom-from-userconf 194 # CHECK: autosuggestion= 195 set -S fish_color_normal 196 # CHECK:$fish_color_normal : set in global scope, unexported, with 2 elements 197 # CHECK:$fish_color_normal [ 1 ] : |yellow| 198 # CHECK:$fish_color_normal [ 2 ] : |--theme=custom-from-userconf| 199 200 echo yes | fish_config theme save 201 set -S fish_color_normal 202 # CHECK:$fish_color_normal : set in universal scope, unexported, with 2 elements 203 # CHECK:$fish_color_normal [ 1 ] : |yellow| 204 # CHECK:$fish_color_normal [ 2 ] : |--theme=custom-from-userconf| 205 206 fish_config theme choose default --color-theme=unknown 207 print-sample-colors 208 # CHECK: normal=--reset --theme=default 209 # CHECK: autosuggestion=brblack --theme=default 210 211 set -S fish_color_normal 212 # CHECK:$fish_color_normal : set in global scope, unexported, with 2 elements 213 # CHECK:$fish_color_normal [ 1 ] : |--reset| 214 # CHECK:$fish_color_normal [ 2 ] : |--theme=default| 215 # CHECK:$fish_color_normal : set in universal scope, unexported, with 2 elements 216 # CHECK:$fish_color_normal [ 1 ] : |yellow| 217 # CHECK:$fish_color_normal [ 2 ] : |--theme=custom-from-userconf| 218 219 echo yes | fish_config theme save default 220 set -S fish_color_normal 221 # CHECK:$fish_color_normal : set in universal scope, unexported, with 1 elements 222 # CHECK:$fish_color_normal [ 1 ] : |--reset| 223} 224 225{ 226 echo >$__fish_config_dir /conf.d/fish_frozen_theme.fish"\ 227set --global fish_color_command 0a0a0a 228set --global fish_color_option 0b0b0b" 229echo > $__fish_config_dir /themes/from-cli.theme "\ 230[light] 231fish_color_command black 232fish_color_param 0c0c0c 233[dark] 234fish_color_command white 235fish_color_param c0c0c0" 236$fish -c ' 237fish_config theme choose from-cli 238echo $fish_color_command 239# CHECK: --theme=from-cli 240echo $fish_color_option 241# CHECK: 0b0b0b 242echo $fish_color_param 243# CHECK: --theme=from-cli 244echo yes | fish_config theme save from-cli 245# CHECKERR: fish_config theme save: error: $fish_terminal_color_theme not yet initialized 246and echo assertion failure 247' 248rm -f $__fish_config_dir /conf.d/fish_frozen_theme.fish 249} 250 251fish_config theme dump badarg 252# CHECKERR: Too many arguments