Skip to content

Commit

Permalink
Merge pull request #23 from Rust-GPU/feat/show
Browse files Browse the repository at this point in the history
feature: show command
  • Loading branch information
schell authored Dec 8, 2024
2 parents 18f3ce9 + c358f6b commit abe597f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/cargo-gpu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,22 @@ impl Toml {
}
}

#[derive(Parser)]
struct Show {
#[clap(long)]
/// Displays the location of the cache directory
cache_directory: bool,
}

impl Show {
fn run(self) {
if self.cache_directory {
log::info!("cache_directory: ");
println!("{}", cache_dir().display());
}
}
}

#[derive(Subcommand)]
enum Command {
/// Install rust-gpu compiler artifacts.
Expand All @@ -719,6 +735,9 @@ enum Command {
/// found in the given toml file.
Toml(Toml),

/// Show some useful values.
Show(Show),

/// A hidden command that can be used to recursively print out all the subcommand help messages:
/// `cargo gpu dump-usage`
/// Useful for updating the README.
Expand Down Expand Up @@ -763,6 +782,7 @@ fn main() {
}
Command::Build(mut build) => build.run(),
Command::Toml(toml) => toml.run(),
Command::Show(show) => show.run(),
Command::DumpUsage => dump_full_usage_for_readme(),
}
}
Expand Down

0 comments on commit abe597f

Please sign in to comment.