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//!
6//! Copyright (c) systemprompt.io — Business Source License 1.1.
7//! See <https://systemprompt.io> for licensing details.
8
9mod count;
10pub mod list;
11pub mod show;
12
13use anyhow::{Context, Result};
14use clap::Subcommand;
15
16use crate::CliConfig;
17use crate::shared::render_result;
18
19#[derive(Debug, Subcommand)]
20pub enum AiCommands {
21    #[command(about = "List AI-generated images")]
22    List(list::ListArgs),
23
24    #[command(about = "Show AI-generated image details")]
25    Show(show::ShowArgs),
26
27    #[command(about = "Count AI-generated images")]
28    Count(count::CountArgs),
29}
30
31pub async fn execute(cmd: AiCommands, config: &CliConfig) -> Result<()> {
32    match cmd {
33        AiCommands::List(args) => {
34            let result = list::execute(args, config)
35                .await
36                .context("Failed to list AI images")?;
37            render_result(&result, config);
38            Ok(())
39        },
40        AiCommands::Show(args) => {
41            let result = show::execute(args, config)
42                .await
43                .context("Failed to show AI image")?;
44            render_result(&result, config);
45            Ok(())
46        },
47        AiCommands::Count(args) => {
48            let result = count::execute(args, config)
49                .await
50                .context("Failed to count AI images")?;
51            render_result(&result, config);
52            Ok(())
53        },
54    }
55}