systemprompt_cli/commands/core/content/files/
mod.rs1mod featured;
8mod link;
9mod list;
10mod unlink;
11
12use anyhow::{Context, Result};
13use clap::Subcommand;
14
15use crate::CliConfig;
16use crate::shared::render_result;
17
18#[derive(Debug, Subcommand)]
19pub enum ContentFilesCommands {
20 #[command(about = "Link a file to content with a specific role")]
21 Link(link::LinkArgs),
22
23 #[command(about = "Unlink a file from content")]
24 Unlink(unlink::UnlinkArgs),
25
26 #[command(about = "List files attached to content")]
27 List(list::ListArgs),
28
29 #[command(about = "Get or set the featured image for content")]
30 Featured(featured::FeaturedArgs),
31}
32
33pub async fn execute(cmd: ContentFilesCommands, config: &CliConfig) -> Result<()> {
34 match cmd {
35 ContentFilesCommands::Link(args) => {
36 let result = link::execute(args, config)
37 .await
38 .context("Failed to link file to content")?;
39 render_result(&result);
40 Ok(())
41 },
42 ContentFilesCommands::Unlink(args) => {
43 let result = unlink::execute(args, config)
44 .await
45 .context("Failed to unlink file from content")?;
46 render_result(&result);
47 Ok(())
48 },
49 ContentFilesCommands::List(args) => {
50 let result = list::execute(args, config)
51 .await
52 .context("Failed to list content files")?;
53 render_result(&result);
54 Ok(())
55 },
56 ContentFilesCommands::Featured(args) => {
57 let result = featured::execute(args, config)
58 .await
59 .context("Failed to get/set featured image")?;
60 render_result(&result);
61 Ok(())
62 },
63 }
64}