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//!
6//! Copyright (c) systemprompt.io — Business Source License 1.1.
7//! See <https://systemprompt.io> for licensing details.
8
9mod generate;
10pub mod show;
11
12use anyhow::{Context, Result};
13use clap::Subcommand;
14
15use crate::CliConfig;
16use crate::shared::render_result;
17
18#[derive(Debug, Subcommand)]
19pub enum SitemapCommands {
20    #[command(about = "Show sitemap configuration", alias = "list")]
21    Show(show::ShowArgs),
22
23    #[command(about = "Generate sitemap.xml")]
24    Generate(generate::GenerateArgs),
25}
26
27pub fn execute(command: SitemapCommands, config: &CliConfig) -> Result<()> {
28    match command {
29        SitemapCommands::Show(args) => {
30            let result = show::execute(args, config).context("Failed to show sitemap")?;
31            render_result(&result, config);
32            Ok(())
33        },
34        SitemapCommands::Generate(args) => {
35            let result = generate::execute(&args, config).context("Failed to generate sitemap")?;
36            render_result(&result, config);
37            Ok(())
38        },
39    }
40}