rustsec_admin/commands/
web.rs

1//! `rustsec-admin web`: Renderer for RustSec Advisory DB web site:
2//!
3//! <https://rustsec.org>
4
5use std::path::PathBuf;
6
7use abscissa_core::{Command, Runnable};
8use clap::Parser;
9
10/// `rustsec-admin web` subcommand
11#[derive(Command, Debug, Default, Parser)]
12pub struct WebCmd {
13    #[arg(
14        num_args = 1..,
15        help = "path to output the generated website (defaults to _site/)"
16    )]
17    path: Vec<PathBuf>,
18}
19
20impl Runnable for WebCmd {
21    fn run(&self) {
22        let output_folder = match self.path.len() {
23            0 => PathBuf::from("_site/"),
24            1 => self.path[0].clone(),
25            _ => unreachable!(),
26        };
27        crate::web::render_advisories(output_folder);
28    }
29}