Prepare using arguments and options

This commit is contained in:
jaby 2022-11-11 16:02:36 +01:00
parent a68b4f520d
commit ff5bbca3a8
3 changed files with 6 additions and 4 deletions

View File

@ -78,7 +78,7 @@
{
"id": "cargo run args",
"type": "pickString",
"options": ["", "--help"],
"options": ["", "--help", "psx bin-cue -o wuff.bin ../Tests/ISO_Planschbecken.xml"],
"default": "",
"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>;
}
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 {
ImageType::BinCue => {
output_path.set_extension("bin");
let cue_output_path = {
let mut cue_output_path = output_path.clone();

View File

@ -9,7 +9,7 @@ struct CommandLine {
#[clap(value_enum, value_parser)]
system_type: SystemType,
#[clap(value_enum, value_parser, default_value_t=OutputType::BinCue)]
#[clap(value_enum, value_parser)]
output_type: OutputType,
#[clap(short='o')]
@ -48,7 +48,7 @@ fn run_main() -> Result<(), Error> {
}
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() {