mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-17 23:58:24 +00:00
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:
1 file changed
+3
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user