Skip to content

Commit 1f7d0a1

Browse files
parse the whole command line without clap
1 parent d588c1b commit 1f7d0a1

File tree

6 files changed

+492
-38
lines changed

6 files changed

+492
-38
lines changed

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ name = "zip-cli"
2626

2727
[dependencies]
2828
clap = { version = "4.5.15", features = ["derive"], optional = true }
29-
eyre = "0.6"
29+
color-eyre = "0.6"
3030

3131
[dependencies.zip]
3232
path = ".."

cli/clite/src/main.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use std::io;
21
#[cfg(not(feature = "clap"))]
32
use std::env;
3+
use std::io;
44

55
#[cfg(feature = "clap")]
66
use clap::{error::ErrorKind, Parser};
@@ -15,7 +15,7 @@ fn main() -> Result<(), Report> {
1515
let ZipCli { verbose, command } = match ZipCli::try_parse() {
1616
Ok(args) => args,
1717
Err(e) => match e.kind() {
18-
ErrorKind::Format | ErrorKind::Io | ErrorKind::InvalidUtf8 => return Err(e.into()),
18+
ErrorKind::Format | ErrorKind::Io => return Err(e.into()),
1919
_ => e.exit(),
2020
},
2121
};
@@ -28,7 +28,9 @@ fn main() -> Result<(), Report> {
2828
};
2929

3030
match command {
31-
ZipCommand::Info | ZipCommand::Extract => Ok(()),
32-
ZipCommand::Compress(compress) => execute_compress(&mut err, compress),
31+
ZipCommand::Info => eyre::bail!("info command not implemented"),
32+
ZipCommand::Extract => eyre::bail!("extract command not implemented"),
33+
ZipCommand::Compress(compress) => execute_compress(&mut err, compress)?,
3334
}
35+
Ok(())
3436
}

0 commit comments

Comments
 (0)