handle_command_not_found: extract constant

This commit is contained in:
Johannes Altmanninger
2026-05-07 16:39:39 +08:00
parent 1f870b360a
commit e25ebf1067

View File

@@ -344,8 +344,9 @@ fn handle_command_not_found(
));
io.append_from_specs(&list, L!(""));
if function::exists(L!("fish_command_not_found"), ctx.parser()) {
let mut buffer = L!("fish_command_not_found").to_owned();
let function_name = L!("fish_command_not_found");
if function::exists(function_name, ctx.parser()) {
let mut buffer = function_name.to_owned();
for arg in &event_args {
buffer.push(' ');
buffer.push_utfstr(&escape(arg));
@@ -353,7 +354,7 @@ fn handle_command_not_found(
let parser = ctx.parser();
let prev_statuses = parser.last_statuses();
let event = Event::generic(L!("fish_command_not_found").to_owned());
let event = Event::generic(function_name.to_owned());
let b = parser.push_block(Block::event_block(event));
parser.eval(&buffer, &io);
parser.pop_block(b);