Skip to main content

systemprompt_cli/commands/core/skills/
mod.rs

1//! `skills` CLI command group: list and show configured skills.
2//!
3//! [`SkillsCommands`] enumerates the subcommands; [`execute`] dispatches each
4//! against the invocation's [`CommandContext`]. Output payload types live in
5//! [`types`].
6
7pub mod types;
8
9mod list;
10mod show;
11
12use anyhow::{Context, Result};
13use clap::Subcommand;
14
15use crate::context::CommandContext;
16use crate::shared::render_result;
17
18#[derive(Debug, Subcommand)]
19pub enum SkillsCommands {
20    #[command(about = "List configured skills")]
21    List(list::ListArgs),
22
23    #[command(about = "Show skill details")]
24    Show(show::ShowArgs),
25}
26
27pub fn execute(command: SkillsCommands, ctx: &CommandContext) -> Result<()> {
28    match command {
29        SkillsCommands::List(args) => {
30            let result = list::execute(args, &ctx.cli).context("Failed to list skills")?;
31            render_result(&result, &ctx.cli);
32            Ok(())
33        },
34        SkillsCommands::Show(args) => {
35            let result = show::execute(&args, &ctx.cli).context("Failed to show skill")?;
36            render_result(&result, &ctx.cli);
37            Ok(())
38        },
39    }
40}