Skip to content

Commit abe597f

Browse files
authored
Merge pull request #23 from Rust-GPU/feat/show
feature: show command
2 parents 18f3ce9 + c358f6b commit abe597f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

crates/cargo-gpu/src/main.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,22 @@ impl Toml {
707707
}
708708
}
709709

710+
#[derive(Parser)]
711+
struct Show {
712+
#[clap(long)]
713+
/// Displays the location of the cache directory
714+
cache_directory: bool,
715+
}
716+
717+
impl Show {
718+
fn run(self) {
719+
if self.cache_directory {
720+
log::info!("cache_directory: ");
721+
println!("{}", cache_dir().display());
722+
}
723+
}
724+
}
725+
710726
#[derive(Subcommand)]
711727
enum Command {
712728
/// Install rust-gpu compiler artifacts.
@@ -719,6 +735,9 @@ enum Command {
719735
/// found in the given toml file.
720736
Toml(Toml),
721737

738+
/// Show some useful values.
739+
Show(Show),
740+
722741
/// A hidden command that can be used to recursively print out all the subcommand help messages:
723742
/// `cargo gpu dump-usage`
724743
/// Useful for updating the README.
@@ -763,6 +782,7 @@ fn main() {
763782
}
764783
Command::Build(mut build) => build.run(),
765784
Command::Toml(toml) => toml.run(),
785+
Command::Show(show) => show.run(),
766786
Command::DumpUsage => dump_full_usage_for_readme(),
767787
}
768788
}

0 commit comments

Comments
 (0)