Add flag for outputing dump file

This commit is contained in:
Jaby 2022-11-18 03:04:52 +01:00 committed by Jaby
parent a6ba90f86b
commit f4701f08b0
3 changed files with 13 additions and 8 deletions

View File

@ -78,7 +78,7 @@
{ {
"id": "cargo run args", "id": "cargo run args",
"type": "pickString", "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": "", "default": "",
"description": "Argument options to pass to cargo run" "description": "Argument options to pass to cargo run"
} }

View File

@ -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> { pub fn dump_content(cd_desc: &CDDesc, mut out: Output) -> Result<(), Error> {
fn write_intro(out: &mut Output) -> Result<(), Error> { fn write_intro(out: &mut Output) -> Result<(), Error> {
writeln!(out, "File: <File name> @<Track relative LBA> - <Size in Bytes>/<Extended size in bytes>")?; writeln!(out, "File: <File name> @<Track relative LBA> - <Size in Bytes>/<Extended size in bytes>")?;
writeln!(out, "Dir: <Directory name> @<Track relative LBA>")?; writeln!(out, "Dir: <Directory name> @<Track relative LBA>")?;
writeln!(out, "")?; writeln!(out, "")?;
Ok(()) 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("<No name>"); let dir_name = dir.name.as_str().unwrap_or("<No name>");
let dir_lba = dir.get_track_rel_lba(); 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)?; dump_dir(&dir, out, indent + INDENT_STEP)?;
} }

View File

@ -6,16 +6,19 @@ use tool_helper::Error;
#[derive(Parser)] #[derive(Parser)]
#[clap(about = "Creates an ISO image from a description file", long_about = None)] #[clap(about = "Creates an ISO image from a description file", long_about = None)]
struct CommandLine { 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, system_type: SystemType,
#[clap(value_enum, value_parser)] #[clap(value_enum, value_parser, help="Specifies the disc image type")]
output_type: ImageType, 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, 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<Option<PathBuf>>,
#[clap(value_parser, help="Input XML path for creating the image")]
input_file: PathBuf, input_file: PathBuf,
} }
@ -44,7 +47,9 @@ fn run_main(cmd_line: CommandLine) -> Result<(), Error> {
} }
println!("\n<== Planschbecken ==>");*/ 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) write_image(desc, encoding_functions.encoder, cmd_line.output_type, cmd_line.output_file)
} }