fish_config: silence error when compiled without embed-data

This commit is contained in:
Johannes Altmanninger
2025-09-08 21:06:19 +02:00
parent 3f7a576835
commit f69c2a4d4a
3 changed files with 21 additions and 8 deletions

View File

@@ -54,7 +54,7 @@ function __fish_complete_man
split($1, t, " ");
sect = substr(t[3], 2, length(t[3]) - 2);
print t[1], sect ": " $2;
}
}
# Solaris 11
# Does not display descriptions
# Solaris apropos outputs embedded backspace in descriptions
@@ -70,7 +70,8 @@ function __fish_complete_man
# Fish commands are not given by apropos
if not set -ql exclude_fish_commands
set -l files $__fish_data_dir/man/man1/*.1*
string replace -r '.*/([^/]+)\.1(\.gz)?$' '$1\t1: fish command' -- $files (status list-files man/man1/ 2>/dev/null)
string replace -r '.*/([^/]+)\.1(\.gz)?$' '$1\t1: fish command' \
-- $files (status list-files man/man1/ 2>/dev/null)
end
else
return 1

View File

@@ -29,7 +29,8 @@ function fish_config --description "Launch fish's web based configuration"
end
set temp (__fish_mktemp_relative -d fish_config)
or return
for dir in (status list-files tools/web_config | path dirname | path sort -u)
for dir in (status list-files tools/web_config |
path dirname | path sort -u)
mkdir -p $temp/$dir
or return
end
@@ -91,7 +92,10 @@ function fish_config --description "Launch fish's web based configuration"
case show
set -l fish (status fish-path)
set -l prompts $prompt_dir/$argv.fish
set -q prompts[1]; or set prompts $prompt_dir/*.fish (status list-files tools/web_config/sample_prompts/ 2>/dev/null)
if not set -q prompts[1]
set prompts $prompt_dir/*.fish \
(status list-files tools/web_config/sample_prompts/ 2>/dev/null)
end
for p in $prompts
if not test -e "$p"
continue
@@ -113,7 +117,8 @@ function fish_config --description "Launch fish's web based configuration"
echo
end
case list ''
files=$prompt_dir/*.theme string replace -r '.*/([^/]*).fish$' '$1' $files (status list-files tools/web_config/sample_prompts/)
files=$prompt_dir/*.theme string replace -r '.*/([^/]*).fish$' '$1' \
$files (status list-files tools/web_config/sample_prompts/ 2>/dev/null)
return
case choose
if set -q argv[2]
@@ -212,7 +217,8 @@ function fish_config --description "Launch fish's web based configuration"
switch $cmd
case list ''
files=$dirs/*.theme string replace -r '.*/([^/]*).theme$' '$1' $files (status list-files tools/web_config/themes/)
files=$dirs/*.theme string replace -r '.*/([^/]*).theme$' '$1' \
$files (status list-files tools/web_config/themes/ 2>/dev/null)
return
case demo
echo -ns (set_color $fish_color_command || set_color $fish_color_normal) /bright/vixens
@@ -240,8 +246,11 @@ function fish_config --description "Launch fish's web based configuration"
echo
case show
set -l fish (status fish-path)
set -l themes $dirs/$argv.theme (status list-files tools/web_config/themes/ | string match -- "*/"$argv.theme)
set -q themes[1]; or set themes $dirs/*.theme (status list-files tools/web_config/themes/)
set -l themes $dirs/$argv.theme \
(status list-files tools/web_config/themes/ 2>/dev/null | string match -- "*/"$argv.theme)
if not set -q themes[1]
set themes $dirs/*.theme (status list-files tools/web_config/themes/ 2>/dev/null)
end
set -l used_themes
echo -s (set_color normal; set_color --underline) Current (set_color normal)

View File

@@ -0,0 +1,3 @@
#RUN: %fish %s
fish_config theme show non-existant-theme >/dev/null