Skip to content

Commit

Permalink
✨ Implement force-ansi
Browse files Browse the repository at this point in the history
  • Loading branch information
czy-29 committed Dec 4, 2024
1 parent 91c22e8 commit ef4f8b2
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
21 changes: 20 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ default-run = "force-ansi"
rust-version = "1.63.0"

[dependencies]
nu-ansi-term = "0.50.1"
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["chrono"] }

Expand Down
29 changes: 28 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
use std::{
env::args_os,
process::{exit, Command},
};

fn main() {
println!("Hello, world!");
#[cfg(windows)]
nu_ansi_term::enable_ansi_support().ok();

let mut args = args_os().skip(1);
exit(match args.next() {
None => -1,
Some(program) => match Command::new(program).args(args).spawn() {
Err(err) => {
eprintln!("{}", err);
-2
}
Ok(mut child) => match child.wait() {
Err(err) => {
eprintln!("{}", err);
-3
}
Ok(code) => match code.code() {
None => -4,
Some(code) => code,
},
},
},
});
}

0 comments on commit ef4f8b2

Please sign in to comment.