From 80dadf1ac1840c5f75932c114fd7af608980be15 Mon Sep 17 00:00:00 2001 From: jaby Date: Fri, 18 Nov 2022 03:04:52 +0100 Subject: [PATCH] Add flag for outputing dump file --- src/Tools/Tools.code-workspace | 2 +- src/Tools/psxcdgen_ex/src/lib.rs | 4 ++-- src/Tools/psxcdgen_ex/src/main.rs | 15 ++++++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Tools/Tools.code-workspace b/src/Tools/Tools.code-workspace index 332cbbeb..24df14b0 100644 --- a/src/Tools/Tools.code-workspace +++ b/src/Tools/Tools.code-workspace @@ -78,7 +78,7 @@ { "id": "cargo run args", "type": "pickString", - "options": ["", "--help", "psx bin-cue -o ../Tests/Test_Planschbecken ../Tests/ISO_Planschbecken.xml"], + "options": ["", "--help", "--list -o ../Tests/Test_Planschbecken psx bin-cue ../Tests/ISO_Planschbecken.xml"], "default": "", "description": "Argument options to pass to cargo run" } diff --git a/src/Tools/psxcdgen_ex/src/lib.rs b/src/Tools/psxcdgen_ex/src/lib.rs index 92116443..65ebeca2 100644 --- a/src/Tools/psxcdgen_ex/src/lib.rs +++ b/src/Tools/psxcdgen_ex/src/lib.rs @@ -20,7 +20,7 @@ pub fn process(config: config_reader::Configuration, calculate_lba: CalculateLBA pub fn dump_content(cd_desc: &CDDesc, mut out: Output) -> Result<(), Error> { fn write_intro(out: &mut Output) -> Result<(), Error> { writeln!(out, "File: @ - /")?; - writeln!(out, "Dir: @")?; + writeln!(out, "Dir: @")?; writeln!(out, "")?; Ok(()) @@ -44,7 +44,7 @@ pub fn dump_content(cd_desc: &CDDesc, mut out: Output) -> Result<(), Error> { let dir_name = dir.name.as_str().unwrap_or(""); let dir_lba = dir.get_track_rel_lba(); - writeln!(out, "{:indent$}Dir: {} @{}", " ", dir_name, dir_lba, indent=indent)?; + writeln!(out, "{:indent$}Dir: {} @{}", " ", dir_name, dir_lba, indent=indent)?; dump_dir(&dir, out, indent + INDENT_STEP)?; } diff --git a/src/Tools/psxcdgen_ex/src/main.rs b/src/Tools/psxcdgen_ex/src/main.rs index a0a2aa9c..c6f3075a 100644 --- a/src/Tools/psxcdgen_ex/src/main.rs +++ b/src/Tools/psxcdgen_ex/src/main.rs @@ -6,16 +6,19 @@ use tool_helper::Error; #[derive(Parser)] #[clap(about = "Creates an ISO image from a description file", long_about = None)] struct CommandLine { - #[clap(value_enum, value_parser)] + #[clap(value_enum, value_parser, help="Specifies the system for which to create the disc image")] system_type: SystemType, - #[clap(value_enum, value_parser)] + #[clap(value_enum, value_parser, help="Specifies the disc image type")] output_type: ImageType, - #[clap(short='o')] + #[clap(short='o', help="Output path; Some OUTPUT_TYPE might create additional files with different endings")] output_file: PathBuf, - #[clap(value_parser)] + #[clap(long="list", id="Path to file", help="If set will list the CD content to stdout; With path will output list to file")] + list_content: Option>, + + #[clap(value_parser, help="Input XML path for creating the image")] input_file: PathBuf, } @@ -44,7 +47,9 @@ fn run_main(cmd_line: CommandLine) -> Result<(), Error> { } println!("\n<== Planschbecken ==>");*/ - psxcdgen_ex::dump_content(&desc, tool_helper::open_output(None)?)?; + if let Some(list_content_option) = cmd_line.list_content { + psxcdgen_ex::dump_content(&desc, tool_helper::open_output(list_content_option)?)?; + } write_image(desc, encoding_functions.encoder, cmd_line.output_type, cmd_line.output_file) }