-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make a new subcrate clite for different features/opt flags
- Loading branch information
1 parent
886c8d4
commit 3f8a4ea
Showing
9 changed files
with
189 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[package] | ||
name = "zip-clite" | ||
version = "0.0.1" | ||
authors = [ | ||
"Danny McClanahan <[email protected]>", | ||
] | ||
license = "MIT" | ||
repository = "https://github.com/zip-rs/zip2.git" | ||
keywords = ["zip", "archive", "compression", "cli"] | ||
categories = ["command-line-utilities", "compression", "filesystem", "development-tools::build-utils"] | ||
# Keep this up to date with clap! | ||
rust-version = "1.74.0" | ||
description = """ | ||
Binary for creation and manipulation of zip files. | ||
""" | ||
edition = "2021" | ||
|
||
# Prevent this from interfering with workspaces | ||
[workspace] | ||
members = ["."] | ||
|
||
[[bin]] | ||
name = "zip-clite" | ||
|
||
[dependencies] | ||
clap = { version = "4.5.15", features = ["derive"] } | ||
eyre = "0.6" | ||
|
||
[dependencies.zip-cli] | ||
path = ".." | ||
default-features = false | ||
features = ["deflate-flate2", "deflate-zlib"] | ||
|
||
# Reduce the size of the zip-cli binary. | ||
[profile.release] | ||
strip = true | ||
lto = true | ||
opt-level = "s" | ||
codegen-units = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use std::io; | ||
|
||
use clap::{error::ErrorKind, Parser}; | ||
use eyre::Report; | ||
|
||
use zip_cli::args::*; | ||
use zip_cli::compress::execute_compress; | ||
use zip_cli::ErrHandle; | ||
|
||
fn main() -> Result<(), Report> { | ||
let ZipCli { verbose, command } = match ZipCli::try_parse() { | ||
Ok(args) => args, | ||
Err(e) => match e.kind() { | ||
ErrorKind::Format | ErrorKind::Io | ErrorKind::InvalidUtf8 => return Err(e.into()), | ||
_ => e.exit(), | ||
}, | ||
}; | ||
let mut err = if verbose { | ||
ErrHandle::Output(io::stderr()) | ||
} else { | ||
ErrHandle::NoOutput | ||
}; | ||
|
||
match command { | ||
ZipCommand::Info | ZipCommand::Extract => Ok(()), | ||
ZipCommand::Compress(compress) => execute_compress(&mut err, compress), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.