status get/list-files: fix minor bugs when compiled without embedded files (#11390)

* man: redirect stderr to /dev/null when checking for embedded files

This fixes a bug where `man status` results in "status: fish was not
built with embedded files⏎" printed.

* fish_config and status completions: redirect stderr to /dev/null when checking for embedded files

I am less sure about this commit, can get rid of it.

* status get-file/list-files: add \n to error message when not compiled with embedded files
This commit is contained in:
Ilya Grigoriev
2025-04-15 23:46:22 -07:00
committed by GitHub
parent 6ede047680
commit 76a6ffe59e
4 changed files with 8 additions and 8 deletions

View File

@@ -71,5 +71,5 @@ complete -f -c status -n "__fish_seen_subcommand_from job-control" -a full -d "S
complete -f -c status -n "__fish_seen_subcommand_from job-control" -a interactive -d "Set only interactive jobs under job control"
complete -f -c status -n "__fish_seen_subcommand_from job-control" -a none -d "Set no jobs under job control"
complete -f -c status -n "__fish_seen_subcommand_from get-file" -a '(status list-files)'
complete -f -c status -n "__fish_seen_subcommand_from list-files" -a '(status list-files)'
complete -f -c status -n "__fish_seen_subcommand_from get-file" -a '(status list-files 2>/dev/null)'
complete -f -c status -n "__fish_seen_subcommand_from list-files" -a '(status list-files 2>/dev/null)'

View File

@@ -127,7 +127,7 @@ function fish_config --description "Launch fish's web based configuration"
end
end
if not set -q have[1]
if status list-files tools/web_config/sample_prompts/$argv[1].fish >/dev/null
if status list-files tools/web_config/sample_prompts/$argv[1].fish &>/dev/null
status get-file tools/web_config/sample_prompts/$argv[1].fish | source
# HACK: `source` gives us a filename of "-", so we check manually if we had a right prompt
set have ""
@@ -170,7 +170,7 @@ function fish_config --description "Launch fish's web based configuration"
end
end
if not set -q have[1]
if status list-files tools/web_config/sample_prompts/$argv[1].fish >/dev/null
if status list-files tools/web_config/sample_prompts/$argv[1].fish &>/dev/null
status get-file tools/web_config/sample_prompts/$argv[1].fish | source
else
echo "No such prompt: '$argv[1]'" >&2
@@ -303,7 +303,7 @@ function fish_config --description "Launch fish's web based configuration"
end
if not set -q file[1]
if status list-files tools/web_config/themes/$argv[1].theme >/dev/null
if status list-files tools/web_config/themes/$argv[1].theme &>/dev/null
set file tools/web_config/themes/$argv[1].theme
else
echo "No such theme: $argv[1]" >&2

View File

@@ -53,7 +53,7 @@ function man --description "Format and display the on-line manual pages"
end
end
if not set -q argv[2] && status list-files "man/man1/$argv[1].1" >/dev/null
if not set -q argv[2] && status list-files "man/man1/$argv[1].1" &>/dev/null
__fish_print_help $argv
return
end

View File

@@ -474,7 +474,7 @@ pub fn status(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> B
}
#[cfg(not(feature = "embed-data"))]
{
streams.err.append(wgettext_fmt!(
streams.err.appendln(wgettext_fmt!(
"%ls: fish was not built with embedded files",
cmd,
));
@@ -520,7 +520,7 @@ pub fn status(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> B
}
#[cfg(not(feature = "embed-data"))]
{
streams.err.append(wgettext_fmt!(
streams.err.appendln(wgettext_fmt!(
"%ls: fish was not built with embedded files",
cmd,
));