Integrate all the progress into master #6
|
@ -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})
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue