Calling un-implemented convert function

This commit is contained in:
jaby 2022-09-17 17:31:51 +02:00
parent d92f6d6cfb
commit 5327d90094
3 changed files with 22 additions and 8 deletions

View File

@ -7,6 +7,6 @@ test_cpp_out: always
test_jaby_engine_fconv: always
@cargo build --manifest-path ../jaby_engine_fconv/Cargo.toml --release
@./../jaby_engine_fconv/target/release/jaby_engine_fconv --help
@./../jaby_engine_fconv/target/release/jaby_engine_fconv -o Test_Planschi.bin Test_PNG.PNG simple-tim full16
always: ;

View File

@ -1,5 +1,5 @@
use clap::{Args, ValueEnum};
use tool_helper::{Input, Output};
use tool_helper::{Error, Input, Output};
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
pub enum ColorDepth {
@ -14,6 +14,6 @@ pub struct Arguments {
color_depth: ColorDepth
}
pub fn convert(_input: Input, _output: Output) {
println!("Bin ein Planschbecken!");
pub fn convert(_args: Arguments, _input: Input, _output: Output) -> Result<(), Error> {
Err(Error::new("Convert not implemented yet".to_owned(), Some(-2)))
}

View File

@ -20,9 +20,23 @@ enum SubCommands {
SimpleTIM(reduced_tim::Arguments)
}
fn main() {
fn run_main() -> tool_helper::Result<()> {
match CommandLine::try_parse() {
Ok(_cmd) => println!("Planschbecken"),
Err(error) => println!("{}", error.to_string())
}
Ok(cmd) => {
let input = tool_helper::open_input(cmd.input_file)?;
let output = tool_helper::open_output(cmd.output_file)?;
match cmd.sub_command {
SubCommands::SimpleTIM(args) => reduced_tim::convert(args, input, output),
}
},
Err(error) => Err(tool_helper::Error::new(error.to_string(), None))
}
}
fn main() {
if let Err(error) = run_main() {
println!("{}", error.text);
std::process::exit(error.exit_code);
}
}