Skip to main content

systemprompt_cli/commands/core/hooks/
mod.rs

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