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