This commit is contained in:
Robin Appelman 2022-04-18 13:15:07 +02:00
commit ada8c26125
2 changed files with 16 additions and 9 deletions

View file

@ -1,15 +1,21 @@
use clap::Parser;
use democutter::cut;
use std::env;
use std::fs;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
/// Path to the source demo
path: String,
/// Start tick
start: u32,
/// End tick
end: Option<u32>,
}
fn main() {
let args: Vec<_> = env::args().collect();
if args.len() < 2 {
println!("1 argument required");
return;
}
let path = args[1].clone();
let file = fs::read(path).unwrap();
let output = cut(&file, 30000, 50000);
let args = Args::parse();
let file = fs::read(&args.path).unwrap();
let output = cut(&file, args.start, args.end.unwrap_or(u32::MAX));
fs::write("out.dem", output).unwrap();
}