mod assign_id;
mod lint;
mod list_affected_versions;
mod osv;
mod sync;
mod version;
mod web;
use self::{
assign_id::AssignIdCmd, lint::LintCmd, list_affected_versions::ListAffectedVersionsCmd,
osv::OsvCmd, sync::SyncCmd, version::VersionCmd, web::WebCmd,
};
use crate::config::AppConfig;
use abscissa_core::{Command, Configurable, Runnable};
use clap::Parser;
use std::path::PathBuf;
#[derive(Command, Debug, Parser, Runnable)]
pub enum AdminSubCmd {
#[command(about = "lint Advisory DB and ensure is well-formed")]
Lint(LintCmd),
#[clap(about = "synchronize information from external sources (osv.dev, NVD, etc.)")]
Sync(SyncCmd),
#[command(about = "render advisory Markdown files for the rustsec.org web site")]
Web(WebCmd),
#[command(about = "display version information")]
Version(VersionCmd),
#[command(about = "assigning RUSTSEC ids to new vulnerabilities")]
AssignId(AssignIdCmd),
#[command(about = "export advisories to OSV format")]
Osv(OsvCmd),
#[command(about = "list affected crate versions")]
ListAffectedVersions(ListAffectedVersionsCmd),
}
#[derive(Command, Debug, Parser)]
#[command(author, version, about)]
pub struct AdminCmd {
#[command(subcommand)]
cmd: AdminSubCmd,
#[arg(short = 'v', long, help = "Increase verbosity")]
pub verbose: bool,
}
impl Runnable for AdminCmd {
fn run(&self) {
self.cmd.run()
}
}
impl Configurable<AppConfig> for AdminCmd {
fn config_path(&self) -> Option<PathBuf> {
None
}
}