From 406e80323431b3a8252e1e2f5d3b4cf49d01b7dc Mon Sep 17 00:00:00 2001 From: Jaby Blubb Date: Sun, 30 Apr 2023 15:46:47 +0200 Subject: [PATCH] Do not display help in red --- src/Tools/cpp_out/src/main.rs | 27 ++++++++++++--------------- src/Tools/psxcdgen_ex/src/main.rs | 7 +++---- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/Tools/cpp_out/src/main.rs b/src/Tools/cpp_out/src/main.rs index 78947958..819fbe71 100644 --- a/src/Tools/cpp_out/src/main.rs +++ b/src/Tools/cpp_out/src/main.rs @@ -32,24 +32,21 @@ fn configurate(cmd: &mut CommandLine) -> Result { Ok(Configuration{file_name, data_name: std::mem::take(&mut cmd.data_name), line_feed: cpp_out::LineFeed::Windows, file_type}) } -fn run_main() -> Result<(), Error> { - match CommandLine::try_parse() { - Ok(mut cmd) => { - let cfg = configurate(&mut cmd)?; - let input = tool_helper::open_input(cmd.input_file)?; - let output = tool_helper::open_output(Some(cmd.output_file))?; +fn run_main(mut cmd: CommandLine) -> Result<(), Error> { + let cfg = configurate(&mut cmd)?; + let input = tool_helper::open_input(cmd.input_file)?; + let output = tool_helper::open_output(Some(cmd.output_file))?; - return cpp_out::convert(cfg, input, output); - }, - Err(error) => Err(tool_helper::Error::from_error(error)) - } + return cpp_out::convert(cfg, input, output); } fn main() { - match run_main() { - Ok(_) => (), - Err(error) => { - exit_with_error(error) - } + match CommandLine::try_parse() { + Ok(cmd) => { + if let Err(error) = run_main(cmd) { + exit_with_error(error) + } + }, + Err(error) => eprintln!("{}", error) } } \ No newline at end of file diff --git a/src/Tools/psxcdgen_ex/src/main.rs b/src/Tools/psxcdgen_ex/src/main.rs index 280d2852..cf1a4a49 100644 --- a/src/Tools/psxcdgen_ex/src/main.rs +++ b/src/Tools/psxcdgen_ex/src/main.rs @@ -55,13 +55,12 @@ fn run_main(cmd_line: CommandLine) -> Result<(), Error> { fn main() { match CommandLine::try_parse() { Ok(cmd_line) => { - match run_main(cmd_line) { - Ok(_) => (), - Err(error) => exit_with_error(error) + if let Err(error) = run_main(cmd_line) { + exit_with_error(error) } }, Err(error) => { - exit_with_error(Error::from_error(error)) + eprintln!("{}", error) } } } \ No newline at end of file