pub mod completions;
use clap::ArgMatches;
use crate::cmd::matcher::{generate::GenerateMatcher, Matcher};
use crate::error::ActionError;
use completions::Completions;
pub struct Generate<'a> {
cmd_matches: &'a ArgMatches<'a>,
}
impl<'a> Generate<'a> {
pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self {
Self { cmd_matches }
}
pub fn invoke(&self) -> Result<(), ActionError> {
let matcher_generate = GenerateMatcher::with(self.cmd_matches).unwrap();
if matcher_generate.matcher_completions().is_some() {
return Completions::new(self.cmd_matches).invoke();
}
unreachable!()
}
}