Add clap
This commit is contained in:
parent
3995b95402
commit
7fcdc3b7e6
|
@ -7,6 +7,7 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cdtypes = {path = "../cdtypes"}
|
cdtypes = {path = "../cdtypes"}
|
||||||
|
clap = {version = "*", features = ["derive"]}
|
||||||
paste = "*"
|
paste = "*"
|
||||||
roxmltree = "*"
|
roxmltree = "*"
|
||||||
tool_helper = {path = "../tool_helper"}
|
tool_helper = {path = "../tool_helper"}
|
|
@ -1,7 +1,14 @@
|
||||||
|
use clap::{Parser, Subcommand};
|
||||||
use psxcdgen_ex::{encoder::psx::{encode_psx_image, calculate_psx_lbas}, file_writer::{ImageType, write_image}, types::{layout::Layout}, config_reader};
|
use psxcdgen_ex::{encoder::psx::{encode_psx_image, calculate_psx_lbas}, file_writer::{ImageType, write_image}, types::{layout::Layout}, config_reader};
|
||||||
use std::{path::PathBuf, str::FromStr};
|
use std::{path::PathBuf, str::FromStr};
|
||||||
use tool_helper::Error;
|
use tool_helper::Error;
|
||||||
|
|
||||||
|
#[derive(Parser)]
|
||||||
|
#[clap(about = "Creates an ISO image from a description file", long_about = None)]
|
||||||
|
struct CommandLine {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
fn run_main() -> Result<(), Error> {
|
fn run_main() -> Result<(), Error> {
|
||||||
let desc = psxcdgen_ex::process(config_reader::parse_xml(std::fs::read_to_string("../Tests/ISO_Planschbecken.xml")?)?, calculate_psx_lbas)?;
|
let desc = psxcdgen_ex::process(config_reader::parse_xml(std::fs::read_to_string("../Tests/ISO_Planschbecken.xml")?)?, calculate_psx_lbas)?;
|
||||||
|
|
||||||
|
@ -25,8 +32,15 @@ fn run_main() -> Result<(), Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match run_main() {
|
match CommandLine::try_parse() {
|
||||||
Ok(_) => println!("\n<== Planschbecken End ==>"),
|
Ok(_) => {
|
||||||
Err(error) => println!("{}", error)
|
match run_main() {
|
||||||
|
Ok(_) => println!("\n<== Planschbecken End ==>"),
|
||||||
|
Err(error) => println!("{}", error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(error) => {
|
||||||
|
println!("{}", error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue