systemprompt_cli/commands/core/content/link/
mod.rs1pub mod delete;
8pub mod generate;
9pub mod list;
10pub mod performance;
11pub mod show;
12
13use crate::cli_settings::CliConfig;
14use crate::shared::render_result;
15use anyhow::{Context, Result};
16use clap::Subcommand;
17
18#[derive(Debug, Subcommand)]
19pub enum LinkCommands {
20 #[command(about = "Generate a trackable campaign link")]
21 Generate(generate::GenerateArgs),
22
23 #[command(about = "Show link details by short code")]
24 Show(show::ShowArgs),
25
26 #[command(about = "List links by campaign or content")]
27 List(list::ListArgs),
28
29 #[command(about = "Show link performance metrics")]
30 Performance(performance::PerformanceArgs),
31
32 #[command(about = "Delete a link")]
33 Delete(delete::DeleteArgs),
34}
35
36pub async fn execute(command: LinkCommands, config: &CliConfig) -> Result<()> {
37 match command {
38 LinkCommands::Generate(args) => {
39 let result = generate::execute(args, config)
40 .await
41 .context("Failed to generate link")?;
42 render_result(&result);
43 },
44 LinkCommands::Show(args) => {
45 let result = show::execute(args, config)
46 .await
47 .context("Failed to show link")?;
48 render_result(&result);
49 },
50 LinkCommands::List(args) => {
51 let result = list::execute(args, config)
52 .await
53 .context("Failed to list links")?;
54 render_result(&result);
55 },
56 LinkCommands::Performance(args) => {
57 let result = performance::execute(args, config)
58 .await
59 .context("Failed to get link performance")?;
60 render_result(&result);
61 },
62 LinkCommands::Delete(args) => {
63 let result = delete::execute(args, config)
64 .await
65 .context("Failed to delete link")?;
66 render_result(&result);
67 },
68 }
69 Ok(())
70}