Prepare using arguments and options

This commit is contained in:
Jaby 2022-11-11 16:02:36 +01:00
parent 74253e40e3
commit 4bf4224808
3 changed files with 6 additions and 4 deletions

View File

@ -78,7 +78,7 @@
{ {
"id": "cargo run args", "id": "cargo run args",
"type": "pickString", "type": "pickString",
"options": ["", "--help"], "options": ["", "--help", "psx bin-cue -o wuff.bin ../Tests/ISO_Planschbecken.xml"],
"default": "", "default": "",
"description": "Argument options to pass to cargo run" "description": "Argument options to pass to cargo run"
} }

View File

@ -35,9 +35,11 @@ pub trait SectorWriter {
fn write(&mut self, sector: Sector) -> Result<usize, Error>; fn write(&mut self, sector: Sector) -> Result<usize, Error>;
} }
pub fn write_image(cd_desc: CDDesc, encoder: EncoderFunction, image_type: ImageType, output_path: PathBuf) -> Result<(), Error> { pub fn write_image(cd_desc: CDDesc, encoder: EncoderFunction, image_type: ImageType, mut output_path: PathBuf) -> Result<(), Error> {
match image_type { match image_type {
ImageType::BinCue => { ImageType::BinCue => {
output_path.set_extension("bin");
let cue_output_path = { let cue_output_path = {
let mut cue_output_path = output_path.clone(); let mut cue_output_path = output_path.clone();

View File

@ -9,7 +9,7 @@ struct CommandLine {
#[clap(value_enum, value_parser)] #[clap(value_enum, value_parser)]
system_type: SystemType, system_type: SystemType,
#[clap(value_enum, value_parser, default_value_t=OutputType::BinCue)] #[clap(value_enum, value_parser)]
output_type: OutputType, output_type: OutputType,
#[clap(short='o')] #[clap(short='o')]
@ -48,7 +48,7 @@ fn run_main() -> Result<(), Error> {
} }
println!("\n<== Planschbecken ==>\nStart encoding"); println!("\n<== Planschbecken ==>\nStart encoding");
write_image(desc, encode_psx_image, ImageType::BinCue, PathBuf::from_str("planschi.bin")?) write_image(desc, encode_psx_image, ImageType::BinCue, PathBuf::from_str("planschi")?)
} }
fn main() { fn main() {