Skip to content

Commit ff8898a

Browse files
remove clap
1 parent 3f8a4ea commit ff8898a

File tree

8 files changed

+479
-453
lines changed

8 files changed

+479
-453
lines changed

cli/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ license = "MIT"
88
repository = "https://github.com/zip-rs/zip2.git"
99
keywords = ["zip", "archive", "compression", "cli"]
1010
categories = ["command-line-utilities", "compression", "filesystem", "development-tools::build-utils"]
11-
# Keep this up to date with clap!
1211
rust-version = "1.74.0"
1312
description = """
1413
Binary for creation and manipulation of zip files.
@@ -25,8 +24,7 @@ members = ["."]
2524
name = "zip-cli"
2625

2726
[dependencies]
28-
clap = { version = "4.5.15", features = ["derive"] }
29-
eyre = "0.6"
27+
color-eyre = "0.6"
3028

3129
[dependencies.zip]
3230
path = ".."
@@ -46,6 +44,7 @@ lzma = ["zip/lzma"]
4644
time = ["zip/time"]
4745
xz = ["zip/xz"]
4846
zstd = ["zip/zstd"]
47+
4948
default = [
5049
"aes-crypto",
5150
"bzip2",
@@ -58,7 +57,6 @@ default = [
5857
]
5958

6059

61-
# Reduce the size of the zip-cli binary.
6260
[profile.release]
6361
strip = true
6462
lto = true

cli/clite/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ license = "MIT"
88
repository = "https://github.com/zip-rs/zip2.git"
99
keywords = ["zip", "archive", "compression", "cli"]
1010
categories = ["command-line-utilities", "compression", "filesystem", "development-tools::build-utils"]
11-
# Keep this up to date with clap!
1211
rust-version = "1.74.0"
1312
description = """
1413
Binary for creation and manipulation of zip files.
@@ -23,15 +22,13 @@ members = ["."]
2322
name = "zip-clite"
2423

2524
[dependencies]
26-
clap = { version = "4.5.15", features = ["derive"] }
2725
eyre = "0.6"
2826

2927
[dependencies.zip-cli]
3028
path = ".."
3129
default-features = false
3230
features = ["deflate-flate2", "deflate-zlib"]
3331

34-
# Reduce the size of the zip-cli binary.
3532
[profile.release]
3633
strip = true
3734
lto = true

cli/clite/src/main.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
1+
use std::env;
12
use std::io;
23

3-
use clap::{error::ErrorKind, Parser};
44
use eyre::Report;
55

66
use zip_cli::args::*;
77
use zip_cli::compress::execute_compress;
88
use zip_cli::ErrHandle;
99

1010
fn main() -> Result<(), Report> {
11-
let ZipCli { verbose, command } = match ZipCli::try_parse() {
12-
Ok(args) => args,
13-
Err(e) => match e.kind() {
14-
ErrorKind::Format | ErrorKind::Io | ErrorKind::InvalidUtf8 => return Err(e.into()),
15-
_ => e.exit(),
16-
},
17-
};
11+
let ZipCli { verbose, command } = ZipCli::parse_argv(env::args_os())?;
1812
let mut err = if verbose {
1913
ErrHandle::Output(io::stderr())
2014
} else {
2115
ErrHandle::NoOutput
2216
};
2317

2418
match command {
25-
ZipCommand::Info | ZipCommand::Extract => Ok(()),
26-
ZipCommand::Compress(compress) => execute_compress(&mut err, compress),
19+
ZipCommand::Info => eyre::bail!("info command not implemented"),
20+
ZipCommand::Extract => eyre::bail!("extract command not implemented"),
21+
ZipCommand::Compress(compress) => execute_compress(&mut err, compress)?,
2722
}
23+
Ok(())
2824
}

0 commit comments

Comments
 (0)