Skip to main content

systemprompt_cli/commands/web/sitemap/
mod.rs

1//! Sitemap inspection and generation for the web content config.
2//!
3//! Dispatches the `web sitemap` subcommands ([`SitemapCommands`]) to show the
4//! configured routes or generate a `sitemap.xml`.
5
6mod generate;
7mod show;
8
9use anyhow::{Context, Result};
10use clap::Subcommand;
11
12use crate::CliConfig;
13use crate::shared::render_result;
14
15#[derive(Debug, Subcommand)]
16pub enum SitemapCommands {
17    #[command(about = "Show sitemap configuration", alias = "list")]
18    Show(show::ShowArgs),
19
20    #[command(about = "Generate sitemap.xml")]
21    Generate(generate::GenerateArgs),
22}
23
24pub fn execute(command: SitemapCommands, config: &CliConfig) -> Result<()> {
25    match command {
26        SitemapCommands::Show(args) => {
27            let result = show::execute(args, config).context("Failed to show sitemap")?;
28            render_result(&result);
29            Ok(())
30        },
31        SitemapCommands::Generate(args) => {
32            let result = generate::execute(&args, config).context("Failed to generate sitemap")?;
33            render_result(&result);
34            Ok(())
35        },
36    }
37}