Skip to content

Commit

Permalink
feat: warning if aiken not in path or managed by other tool
Browse files Browse the repository at this point in the history
  • Loading branch information
rvcas committed Jun 14, 2024
1 parent 5b37659 commit 352254b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
28 changes: 28 additions & 0 deletions 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 @@ -32,6 +32,7 @@ tar = "0.4.40"
thiserror = "1.0.58"
tokio = { version = "1.37.0", features = ["full"] }
toml = "0.8.13"
which = "6.0.1"

# The profile that 'cargo dist' will build with
[profile.dist]
Expand Down
23 changes: 23 additions & 0 deletions src/cmd/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use http_body_util::BodyExt;
use miette::IntoDiagnostic;
use semver::Version;
use tar::Archive;
use which::which;

use crate::{
ctx,
Expand Down Expand Up @@ -261,6 +262,28 @@ impl Args {
}
}

match which("aiken") {
Ok(path) if path.display().to_string().contains(".aiken/bin") => (),
Ok(_) => {
println!(
"{} {}",
ctx.aikup_label(),
ctx.colors
.warning_text("aiken is in your PATH but not managed by this tool")
);
}
Err(_) => {
println!(
"{} {}",
ctx.aikup_label(),
ctx.colors.warning_text(format!(
"aiken not found in your $PATH, please add \"{}\" to your $PATH",
bin_dir.display()
))
);
}
}

Ok(())
}
}
Expand Down

0 comments on commit 352254b

Please sign in to comment.