Skip to content

Commit

Permalink
cli: Allow setting pad_len for add and replace
Browse files Browse the repository at this point in the history
  • Loading branch information
wcampbell0x2a committed Sep 1, 2024
1 parent f9713b8 commit 286a947
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backhand-cli/src/bin/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ struct Args {
/// Override mtime read from <FILE>
#[clap(long, required_if_eq("dir", "true"))]
mtime: Option<u32>,

/// Custom KiB padding length
#[clap(long)]
pad_len: Option<u32>,
}

fn main() -> ExitCode {
Expand Down Expand Up @@ -103,6 +107,10 @@ fn main() -> ExitCode {
}
}

if let Some(pad_len) = args.pad_len {
filesystem.set_kib_padding(pad_len)
}

// write new file
let output = File::create(&args.out).unwrap();
if let Err(e) = filesystem.write(output) {
Expand Down
8 changes: 8 additions & 0 deletions backhand-cli/src/bin/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ struct Args {
/// Squashfs output image
#[clap(short, long, default_value = "replaced.squashfs")]
out: PathBuf,

/// Custom KiB padding length
#[clap(long)]
pad_len: Option<u32>,
}

fn main() -> ExitCode {
Expand All @@ -54,6 +58,10 @@ fn main() -> ExitCode {
return ExitCode::FAILURE;
}

if let Some(pad_len) = args.pad_len {
filesystem.set_kib_padding(pad_len)
}

// write new file
let output = File::create(&args.out).unwrap();
filesystem.write(output).unwrap();
Expand Down

0 comments on commit 286a947

Please sign in to comment.