systemprompt_cli/commands/core/content/analytics/
mod.rs1pub mod campaign;
10pub mod clicks;
11pub mod journey;
12
13use crate::context::CommandContext;
14use crate::shared::render_result;
15use anyhow::{Context, Result};
16use clap::Subcommand;
17
18#[derive(Debug, Subcommand)]
19pub enum AnalyticsCommands {
20 #[command(about = "Show click history for a link")]
21 Clicks(clicks::ClicksArgs),
22
23 #[command(about = "Show campaign-level analytics")]
24 Campaign(campaign::CampaignArgs),
25
26 #[command(about = "Show content navigation graph")]
27 Journey(journey::JourneyArgs),
28}
29
30pub async fn execute(command: AnalyticsCommands, ctx: &CommandContext) -> Result<()> {
31 match command {
32 AnalyticsCommands::Clicks(args) => {
33 let result = clicks::execute(args, ctx)
34 .await
35 .context("Failed to get link clicks")?;
36 render_result(&result, &ctx.cli);
37 },
38 AnalyticsCommands::Campaign(args) => {
39 let result = campaign::execute(args, ctx)
40 .await
41 .context("Failed to get campaign analytics")?;
42 render_result(&result, &ctx.cli);
43 },
44 AnalyticsCommands::Journey(args) => {
45 let result = journey::execute(args, ctx)
46 .await
47 .context("Failed to get content journey")?;
48 render_result(&result, &ctx.cli);
49 },
50 }
51 Ok(())
52}