Skip to main content

systemprompt_cli/commands/core/skills/
mod.rs

1pub mod types;
2
3mod list;
4mod show;
5
6use anyhow::{Context, Result};
7use clap::Subcommand;
8
9use crate::CliConfig;
10use crate::cli_settings::get_global_config;
11use crate::shared::render_result;
12
13#[derive(Debug, Subcommand)]
14pub enum SkillsCommands {
15    #[command(about = "List configured skills")]
16    List(list::ListArgs),
17
18    #[command(about = "Show skill details")]
19    Show(show::ShowArgs),
20}
21
22pub fn execute(command: SkillsCommands) -> Result<()> {
23    let config = get_global_config();
24    execute_with_config(command, &config)
25}
26
27pub fn execute_with_config(command: SkillsCommands, config: &CliConfig) -> Result<()> {
28    match command {
29        SkillsCommands::List(args) => {
30            let result = list::execute(args, config).context("Failed to list skills")?;
31            render_result(&result);
32            Ok(())
33        },
34        SkillsCommands::Show(args) => {
35            let result = show::execute(&args, config).context("Failed to show skill")?;
36            render_result(&result);
37            Ok(())
38        },
39    }
40}