systemprompt_cli/commands/core/hooks/
mod.rs1pub mod types;
7
8mod list;
9mod validate;
10
11use anyhow::{Context, Result};
12use clap::Subcommand;
13
14use crate::cli_settings::get_global_config;
15use crate::shared::render_result;
16
17#[derive(Debug, Clone, Copy, Subcommand)]
18pub enum HooksCommands {
19 #[command(about = "List hooks across all plugins")]
20 List(list::ListArgs),
21
22 #[command(about = "Validate all hook definitions")]
23 Validate(validate::ValidateArgs),
24}
25
26pub fn execute(command: HooksCommands) -> Result<()> {
27 let config = get_global_config();
28
29 match command {
30 HooksCommands::List(args) => {
31 let result = list::execute(args, &config).context("Failed to list hooks")?;
32 render_result(&result);
33 Ok(())
34 },
35 HooksCommands::Validate(args) => {
36 let result = validate::execute(args, &config).context("Failed to validate hooks")?;
37 render_result(&result);
38 Ok(())
39 },
40 }
41}