rustsec_admin/commands/
assign_id.rs1use abscissa_core::{Command, Runnable};
6use clap::Parser;
7use std::path::{Path, PathBuf};
8
9#[derive(Command, Debug, Default, Parser)]
11pub struct AssignIdCmd {
12 #[arg(long = "github-actions-output")]
13 github_action_output: bool,
14 #[arg(
16 num_args = 1..,
17 help = "filesystem path to the RustSec advisory DB git repo"
18 )]
19 path: Vec<PathBuf>,
20}
21
22impl Runnable for AssignIdCmd {
23 fn run(&self) {
24 let repo_path = match self.path.len() {
25 0 => Path::new("."),
26 1 => self.path[0].as_path(),
27 _ => unreachable!(),
28 };
29 let output_mode = if self.github_action_output {
30 crate::assigner::OutputMode::GithubAction
31 } else {
32 crate::assigner::OutputMode::HumanReadable
33 };
34
35 crate::assigner::assign_ids(repo_path, output_mode);
36 }
37}