mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 01:51:14 -03:00
set: fix unreachable error messages
- Remove unreachable error message in `handle_env_return()` While we could have put an empty block in `handle_env_return()` and removed the condition on `NotFound` in `erase()`, we prefered to use `unreachable!` in case `handle_env_return()` gets called in new scenarios in the future - Make reachable the error message when asking to show a slice Part of #12603
This commit is contained in:
committed by
Johannes Altmanninger
parent
fb57f95391
commit
68453843d4
@@ -575,10 +575,6 @@ msgstr ""
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s: Das Verzeichnis '%s' existiert nicht"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s: Es gibt keine Jobs"
|
||||
|
||||
@@ -575,10 +575,6 @@ msgstr ""
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s: The directory “%s” does not exist"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s: There are no jobs"
|
||||
|
||||
@@ -575,10 +575,6 @@ msgstr "%s: La opción corta '%c' no es válida, debe ser alfanumérica o '#'"
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s: El directorio '%s' no existe"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr "%s: La variable '%s' no existe"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s: No hay trabajos"
|
||||
|
||||
@@ -704,10 +704,6 @@ msgstr "%s : Le sémaphore « %c » est invalide : il doit être alphanumér
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s : Le dossier « %s » n’existe pas"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s : Aucune tâche"
|
||||
|
||||
@@ -574,10 +574,6 @@ msgstr "%s: 短縮フラグ '%c' は無効です。英数字または '#' であ
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s: ディレクトリ '%s' は存在しません"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr "%s: 変数 '%s' は存在しません"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s: ジョブはありません"
|
||||
|
||||
@@ -571,10 +571,6 @@ msgstr ""
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s: Ścieżka '%s' nie istnieje"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s: Nie ma żadnych zadań"
|
||||
|
||||
@@ -576,10 +576,6 @@ msgstr ""
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s: O diretório “%s” não existe"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s: Não há tarefas"
|
||||
|
||||
@@ -572,10 +572,6 @@ msgstr ""
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s: Katalogen '%s' existerar inte"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s: Det finns inga jobb"
|
||||
|
||||
@@ -596,10 +596,6 @@ msgstr "%s: 短标识 '%c' 无效,必须是字母、数字或 '#'"
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s: 目录 '%s' 不存在"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr "%s: 变量 '%s' 不存在"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s: 没有作业"
|
||||
|
||||
@@ -569,10 +569,6 @@ msgstr "%s:短旗標「%c」無效,必須是字母、數字、或「#」"
|
||||
msgid "%s: The directory '%s' does not exist"
|
||||
msgstr "%s:目錄「%s」不存在"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: The variable '%s' does not exist"
|
||||
msgstr "%s:變數「%s」不存在"
|
||||
|
||||
#, c-format
|
||||
msgid "%s: There are no jobs"
|
||||
msgstr "%s:沒有作業"
|
||||
|
||||
@@ -351,11 +351,8 @@ fn handle_env_return(retval: EnvStackSetResult, cmd: &wstr, key: &wstr, streams:
|
||||
));
|
||||
}
|
||||
EnvStackSetResult::NotFound => {
|
||||
streams.err.appendln(&wgettext_fmt!(
|
||||
"%s: The variable '%s' does not exist",
|
||||
cmd,
|
||||
key
|
||||
));
|
||||
// Only variable deletion can return a `NotFound` error, but that case is explicitly silenced
|
||||
unreachable!("variable not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -729,13 +726,20 @@ fn show(cmd: &wstr, parser: &Parser, streams: &mut IoStreams, args: &[&wstr]) ->
|
||||
}
|
||||
} else {
|
||||
for arg in args.iter().copied() {
|
||||
let bracket = arg.find(L!("["));
|
||||
let arg = if let Some(idx) = bracket {
|
||||
&arg[..idx]
|
||||
} else {
|
||||
arg
|
||||
};
|
||||
|
||||
if !valid_var_name(arg) {
|
||||
streams.err.append(&varname_error(cmd, arg));
|
||||
builtin_print_error_trailer(parser, streams.err, cmd);
|
||||
return Err(STATUS_INVALID_ARGS);
|
||||
}
|
||||
|
||||
if arg.contains('[') {
|
||||
if bracket.is_some() {
|
||||
streams.err.appendln(&wgettext_fmt!(
|
||||
"%s: `set --show` does not allow slices with the var names",
|
||||
cmd
|
||||
|
||||
@@ -49,7 +49,6 @@ else
|
||||
end
|
||||
# CHECK: Test 4 pass
|
||||
|
||||
|
||||
#Test that scope is preserved when setting a new value
|
||||
|
||||
set t5 a
|
||||
@@ -79,7 +78,6 @@ for i in 1
|
||||
end
|
||||
# CHECK: Test 6 pass
|
||||
|
||||
|
||||
# Test if variables in for loop blocks do not go out of scope on new laps
|
||||
|
||||
set res fail
|
||||
@@ -405,7 +403,6 @@ set -x DONT_ESCAPE_COLONS_PATH 1: 2: :3:
|
||||
env | grep '^DONT_ESCAPE_COLONS_PATH='
|
||||
# CHECK: DONT_ESCAPE_COLONS_PATH=1::2:::3:
|
||||
|
||||
|
||||
# Path universal variables
|
||||
set -U __fish_test_path_not a b c
|
||||
set -U __fish_test_PATH 1 2 3
|
||||
@@ -485,7 +482,6 @@ set -g __fish_test_global_vs_universal global
|
||||
echo "global-vs-universal 2: $__fish_test_global_vs_universal"
|
||||
# CHECK: global-vs-universal 2: global
|
||||
|
||||
|
||||
set __fish_test_global_vs_universal global2
|
||||
echo "global-vs-universal 3: $__fish_test_global_vs_universal"
|
||||
# CHECK: global-vs-universal 3: global2
|
||||
@@ -537,6 +533,13 @@ set --show 'argle bargle'
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help set' for related documentation)
|
||||
|
||||
set --show array[1]
|
||||
# CHECKERR: set: `set --show` does not allow slices with the var names
|
||||
# CHECKERR: {{.*}}set.fish (line {{\d+}}):
|
||||
# CHECKERR: set --show array[1]
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: (Type 'help set' for related documentation)
|
||||
|
||||
# Verify behavior of `set --show`
|
||||
set semiempty ''
|
||||
set --show semiempty
|
||||
@@ -747,7 +750,6 @@ echo $foo
|
||||
echo $bar
|
||||
#CHECK: 1 3
|
||||
|
||||
|
||||
# Test that `set -q` does not return 0 if there are 256 missing variables
|
||||
|
||||
set -lq a(seq 1 256)
|
||||
@@ -809,14 +811,14 @@ set -S stilllocal
|
||||
set -g globalvar global
|
||||
|
||||
function test-function-scope
|
||||
set -f funcvar "function"
|
||||
set -f funcvar function
|
||||
echo $funcvar
|
||||
# CHECK: function
|
||||
set -S funcvar
|
||||
#CHECK: $funcvar: set in local scope, unexported, with 1 elements
|
||||
#CHECK: $funcvar[1]: |function|
|
||||
begin
|
||||
set -l funcvar "block"
|
||||
set -l funcvar block
|
||||
echo $funcvar
|
||||
# CHECK: block
|
||||
set -S funcvar
|
||||
@@ -1015,7 +1017,6 @@ set line[0] ""
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: (Type 'help set' for related documentation)
|
||||
|
||||
|
||||
echo Still here
|
||||
# CHECK: Still here
|
||||
|
||||
|
||||
Reference in New Issue
Block a user