Skip to content

Commit eaade91

Browse files
committed
feat: no need to use console
1 parent 0e60862 commit eaade91

File tree

3 files changed

+31
-124
lines changed

3 files changed

+31
-124
lines changed

Cargo.lock

Lines changed: 16 additions & 114 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ gix = {version = "0.53", default-features = false, features = ["max-performance-
1010
anyhow = "1.0"
1111
env_logger = "0.10"
1212
log = "0.4"
13-
# clap = { version = "4.4", features = ["derive"] }
14-
console = "0.15"
13+

src/main.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use anyhow::{anyhow, Result};
2-
use console::style;
32
use gix::state::InProgress;
43
use gix::{
54
sec::{self, trust::DefaultForLevel},
@@ -45,10 +44,11 @@ fn main() {
4544
let cmd = Command::new("git")
4645
.arg("status")
4746
.arg("--porcelain")
48-
.output()
49-
.ok();
47+
.output();
5048

51-
if let Some(cmd) = cmd {
49+
let mut status = 0;
50+
51+
if let Ok(cmd) = cmd {
5252
if cmd.status.success() {
5353
let out = String::from_utf8_lossy(&cmd.stdout);
5454
let out = out
@@ -61,15 +61,18 @@ fn main() {
6161
for i in out {
6262
match i {
6363
None => {
64-
println!("{}", style(s).green());
64+
println!("{s}");
65+
status = 5;
6566
break;
6667
}
6768
Some("M") => {
68-
println!("{}", style(&s).red());
69+
println!("{s}");
70+
status = 6;
6971
break;
7072
}
7173
Some("??") => {
72-
println!("{}", style(&s).magenta().bold());
74+
println!("{s}");
75+
status = 7;
7376
break;
7477
}
7578
_ => continue,
@@ -78,9 +81,12 @@ fn main() {
7881
}
7982
}
8083
} else {
81-
println!("{s}")
84+
println!("{s}");
85+
status = 8;
8286
}
8387
}
88+
89+
exit(status)
8490
}
8591

8692
fn get_output(path: PathBuf) -> Result<String> {

0 commit comments

Comments
 (0)