anonymize cli option

This commit is contained in:
Robin Appelman 2026-10-25 17:27:33 +01:00
commit 90afd1d100
4 changed files with 138 additions and 6 deletions

View file

@ -7,6 +7,8 @@ use std::fs;
struct Args {
/// Path to the source demo
path: String,
/// Path to the target demo, defaults to `out.dem`
output_path: Option<String>,
#[arg(long)]
unlock_pov: bool,
#[arg(long)]
@ -17,6 +19,8 @@ struct Args {
remove_invalid_deletes: bool,
#[arg(long)]
fix_player_count: bool,
#[arg(long)]
anonymize: bool,
}
impl Args {
@ -24,12 +28,15 @@ impl Args {
let builder = EditOptions::builder()
.unlock_pov(self.unlock_pov)
.remove_invalid_deletes(self.remove_invalid_deletes)
.fix_player_count(self.fix_player_count);
.fix_player_count(self.fix_player_count)
.anonymize(self.anonymize);
if let (Some(from), Some(to)) = (self.from, self.to) {
builder.cut(TickRange {
from: from.into(),
to: to.into(),
}).build()
builder
.cut(TickRange {
from: from.into(),
to: to.into(),
})
.build()
} else {
builder.build()
}
@ -42,5 +49,6 @@ fn main() {
let options = args.get_options();
let file = fs::read(&args.path).unwrap();
let output = edit(&file, options);
fs::write("out.dem", output).unwrap();
let output_path = args.output_path.as_deref().unwrap_or("out.dem");
fs::write(output_path, output).unwrap();
}