use crate::prelude::*;
use crate::config::PitchforkConfig;
use abscissa_core::{config, Command, FrameworkError, Options, Runnable};
#[derive(Command, Debug, Options)]
pub struct StartCmd {
#[options(free)]
recipient: Vec<String>,
}
impl Runnable for StartCmd {
fn run(&self) {
let config = app_config();
println!("Hello, {}!", &config.hello.recipient);
}
}
impl config::Override<PitchforkConfig> for StartCmd {
fn override_config(
&self,
mut config: PitchforkConfig,
) -> Result<PitchforkConfig, FrameworkError> {
if !self.recipient.is_empty() {
config.hello.recipient = self.recipient.join(" ");
}
Ok(config)
}
}