Do not display help in red
This commit is contained in:
parent
e8ae8a8798
commit
406e803234
|
@ -32,24 +32,21 @@ fn configurate(cmd: &mut CommandLine) -> Result<Configuration, Error> {
|
||||||
Ok(Configuration{file_name, data_name: std::mem::take(&mut cmd.data_name), line_feed: cpp_out::LineFeed::Windows, file_type})
|
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> {
|
fn run_main(mut cmd: CommandLine) -> Result<(), Error> {
|
||||||
match CommandLine::try_parse() {
|
let cfg = configurate(&mut cmd)?;
|
||||||
Ok(mut cmd) => {
|
let input = tool_helper::open_input(cmd.input_file)?;
|
||||||
let cfg = configurate(&mut cmd)?;
|
let output = tool_helper::open_output(Some(cmd.output_file))?;
|
||||||
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);
|
return cpp_out::convert(cfg, input, output);
|
||||||
},
|
|
||||||
Err(error) => Err(tool_helper::Error::from_error(error))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match run_main() {
|
match CommandLine::try_parse() {
|
||||||
Ok(_) => (),
|
Ok(cmd) => {
|
||||||
Err(error) => {
|
if let Err(error) = run_main(cmd) {
|
||||||
exit_with_error(error)
|
exit_with_error(error)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
Err(error) => eprintln!("{}", error)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -55,13 +55,12 @@ fn run_main(cmd_line: CommandLine) -> Result<(), Error> {
|
||||||
fn main() {
|
fn main() {
|
||||||
match CommandLine::try_parse() {
|
match CommandLine::try_parse() {
|
||||||
Ok(cmd_line) => {
|
Ok(cmd_line) => {
|
||||||
match run_main(cmd_line) {
|
if let Err(error) = run_main(cmd_line) {
|
||||||
Ok(_) => (),
|
exit_with_error(error)
|
||||||
Err(error) => exit_with_error(error)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
exit_with_error(Error::from_error(error))
|
eprintln!("{}", error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue