Skip to main content

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

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