systemprompt_cli/commands/core/artifacts/
mod.rs1mod list;
2mod show;
3mod types;
4
5use crate::cli_settings::CliConfig;
6use crate::shared::render_result;
7use anyhow::Result;
8use clap::Subcommand;
9use systemprompt_database::DbPool;
10
11pub use types::*;
12
13#[derive(Debug, Subcommand)]
14pub enum ArtifactsCommands {
15 #[command(about = "List artifacts")]
16 List(list::ListArgs),
17
18 #[command(about = "Show artifact details and content")]
19 Show(show::ShowArgs),
20}
21
22pub async fn execute(cmd: ArtifactsCommands, config: &CliConfig) -> Result<()> {
23 match cmd {
24 ArtifactsCommands::List(args) => {
25 let result = list::execute(args, config).await?;
26 render_result(&result);
27 },
28 ArtifactsCommands::Show(args) => {
29 let result = show::execute(args, config).await?;
30 render_result(&result);
31 },
32 }
33 Ok(())
34}
35
36pub async fn execute_with_db(
37 cmd: ArtifactsCommands,
38 db_pool: &DbPool,
39 user_id: &systemprompt_identifiers::UserId,
40 config: &CliConfig,
41) -> Result<()> {
42 match cmd {
43 ArtifactsCommands::List(args) => {
44 let result = list::execute_with_pool(args, user_id, db_pool, config).await?;
45 render_result(&result);
46 },
47 ArtifactsCommands::Show(args) => {
48 let result = show::execute_with_pool(args, db_pool, config).await?;
49 render_result(&result);
50 },
51 }
52 Ok(())
53}