From 76462932202873dc19ea89a27ed7d5ab03d11cb0 Mon Sep 17 00:00:00 2001 From: SadlyNotSappho Date: Sun, 9 Jul 2023 15:36:19 -0700 Subject: [PATCH] wrote this base code a while ago, figured i'd put it on git --- .gitignore | 2 ++ Cargo.toml | 10 ++++++++++ src/main.rs | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore index 3ca43ae..419cff3 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb +# Added by cargo +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0dc07b4 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "archive-helper" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +clap = { version = "4.3.11", features = ["derive"] } +compress-tools = "0.14.3" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..7e2210b --- /dev/null +++ b/src/main.rs @@ -0,0 +1,23 @@ +use std::{path::Path, fs::File}; + +use clap::Parser; +use compress_tools::*; + +#[derive(Parser, Debug)] +struct Args { + #[arg(short, long)] + input: String, + + #[arg(short, long)] + output: String, +} + +fn main() { + let args = Args::parse(); + println!("{:?}", args); + + let mut source = File::open(args.input).unwrap(); + let dest = Path::new(&args.output); + + uncompress_archive(&mut source, &dest, Ownership::Preserve).unwrap(); +}