Skip to content

Commit

Permalink
add cmd_plugin to cli for ease of testing
Browse files Browse the repository at this point in the history
  • Loading branch information
j-lanson committed Aug 20, 2024
1 parent 562a18e commit c9b9f14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions hipcheck/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ pub enum FullCommands {
Ready,
Update(UpdateArgs),
Cache(CacheArgs),
Plugin,
PrintConfig,
PrintData,
PrintCache,
Expand All @@ -391,6 +392,7 @@ impl From<&Commands> for FullCommands {
Commands::Scoring => FullCommands::Scoring,
Commands::Update(args) => FullCommands::Update(args.clone()),
Commands::Cache(args) => FullCommands::Cache(args.clone()),
Commands::Plugin => FullCommands::Plugin,
}
}
}
Expand Down Expand Up @@ -419,6 +421,9 @@ pub enum Commands {
Update(UpdateArgs),
/// Manage Hipcheck cache
Cache(CacheArgs),
/// Execute temporary code for exercising plugin engine
#[command(hide = true)]
Plugin,
}

// If no subcommand matched, default to use of '-t <TYPE> <TARGET' syntax. In
Expand Down
5 changes: 3 additions & 2 deletions hipcheck/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ fn main() -> ExitCode {
Some(FullCommands::Check(args)) => return cmd_check(&args, &config),
Some(FullCommands::Schema(args)) => cmd_schema(&args),
Some(FullCommands::Setup(args)) => return cmd_setup(&args, &config),
Some(FullCommands::Ready) => cmd_plugin(&config),
Some(FullCommands::Ready) => cmd_ready(&config),
Some(FullCommands::Update(args)) => cmd_update(&args),
Some(FullCommands::Cache(args)) => return cmd_cache(args, &config),
Some(FullCommands::Plugin) => cmd_plugin(),
Some(FullCommands::PrintConfig) => cmd_print_config(config.config()),
Some(FullCommands::PrintData) => cmd_print_data(config.data()),
Some(FullCommands::PrintCache) => cmd_print_home(config.cache()),
Expand Down Expand Up @@ -622,7 +623,7 @@ fn check_github_token() -> StdResult<(), EnvVarCheckError> {
})
}

fn cmd_plugin(config: &CliConfig) {
fn cmd_plugin() {
use tokio::runtime::Runtime;
let tgt_dir = "./target/debug";
let entrypoint = pathbuf![tgt_dir, "dummy_rand_data"];
Expand Down

0 comments on commit c9b9f14

Please sign in to comment.