Skip to main content

systemprompt_cli/commands/core/files/ai/
mod.rs

1mod count;
2mod list;
3mod show;
4
5use anyhow::{Context, Result};
6use clap::Subcommand;
7
8use crate::shared::render_result;
9use crate::CliConfig;
10
11#[derive(Debug, Subcommand)]
12pub enum AiCommands {
13    #[command(about = "List AI-generated images")]
14    List(list::ListArgs),
15
16    #[command(about = "Show AI-generated image details")]
17    Show(show::ShowArgs),
18
19    #[command(about = "Count AI-generated images")]
20    Count(count::CountArgs),
21}
22
23pub async fn execute(cmd: AiCommands, config: &CliConfig) -> Result<()> {
24    match cmd {
25        AiCommands::List(args) => {
26            let result = list::execute(args, config)
27                .await
28                .context("Failed to list AI images")?;
29            render_result(&result);
30            Ok(())
31        },
32        AiCommands::Show(args) => {
33            let result = show::execute(args, config)
34                .await
35                .context("Failed to show AI image")?;
36            render_result(&result);
37            Ok(())
38        },
39        AiCommands::Count(args) => {
40            let result = count::execute(args, config)
41                .await
42                .context("Failed to count AI images")?;
43            render_result(&result);
44            Ok(())
45        },
46    }
47}