M0.9: escape terminal controls in CLI operation errors

Apply the existing printable-text rule at the final Usage and Failed error output boundary, preserving exit codes and the help footer.
This commit is contained in:
Mex authored and GitHub committed 2026-11-15 19:52:03 +01:00
1 parent 0015eb5f06
commit fff48fc441
1 file changed
+3 -2
+3 -2
View File
@@ -38,14 +38,15 @@ fn main() -> ExitCode {
return ExitCode::from(u8::try_from(e.exit_code()).unwrap_or(2));
}
};
// Paths and imported/plugin errors may carry terminal controls; keep diagnostics printable.
match run(cli) {
Ok(code) => code,
Err(CliError::Usage(msg)) => {
eprintln!("error: {msg}\n\nFor more information, try '--help'.");
eprintln!("error: {}\n\nFor more information, try '--help'.", files::plain(&msg));
ExitCode::from(2)
}
Err(CliError::Failed(msg)) => {
eprintln!("error: {msg}");
eprintln!("error: {}", files::plain(&msg));
ExitCode::from(1)
}
}