Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mommy can tell you her version now #89

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {

// Time for mommy to call cargo~
let mut cmd = std::process::Command::new(&cargo);
cmd.args(args)

cmd.args(args.clone())
.env(RECURSION_LIMIT_VAR, new_limit.to_string());
let status: std::process::ExitStatus = cmd.status().map_err(|err: std::io::Error| {
format!("{true_role} tried looking everywhere, but did not find `{cargo}`: {err}",)
Expand All @@ -169,6 +170,21 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {
return Ok(code);
}

// Mommy can tell you how old she is :D
if args.contains(&"-V".to_string()) || args.contains(&"--version".to_string()) {
print!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
if let Some(c) = option_env!("CARGO_COMMIT_SHORT_HASH") {
print!(" ({}", c);

match option_env!("CARGO_COMMIT_DATE") {
Some(c) => print!(" {})", c),
None => print!(")"),
}
}

println!();
}

// Time for mommy to tell you how you did~
let response = if status.success() {
select_response(&true_role, &rng, ResponseType::Positive)
Expand Down