Skip to content
Snippets Groups Projects
Commit ed55d5b4 authored by Stephen D's avatar Stephen D
Browse files

it works

parents
No related branches found
No related tags found
No related merge requests found
/target
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "anyhow"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
[[package]]
name = "cargo-gg"
version = "0.1.0"
dependencies = [
"anyhow",
]
[package]
name = "cargo-gg"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0.95"
use std::{env, fs::File, process::Command};
fn main() -> anyhow::Result<()> {
let mut arg_iter = env::args().peekable();
arg_iter.next();
if arg_iter.peek().map_or(false, |arg| arg == "gg") {
let _ = arg_iter.next();
}
let args: Vec<_> = arg_iter.collect();
let mut cmd = Command::new("cargo");
cmd.args(args);
let status = cmd.status()?;
let code = status.code().unwrap_or(1);
let path = env::temp_dir().join(".gg-failed");
if code == 0 {
if std::fs::exists(&path)? {
println!("Good girl!");
let _ = std::fs::remove_file(path);
}
} else {
let _ = File::create(env::temp_dir().join(".gg-failed"));
}
Ok(())
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment