cuddle-please/crates/cuddle-please-commands/src/config_command.rs

28 lines
680 B
Rust
Raw Normal View History

use cuddle_please_frontend::PleaseConfig;
use cuddle_please_misc::DynUi;
use crate::command::ConfigCommand;
pub struct ConfigCommandHandler {
ui: DynUi,
config: PleaseConfig,
}
impl ConfigCommandHandler {
pub fn new(ui: DynUi, config: PleaseConfig) -> Self {
Self { ui, config }
}
pub fn execute(&self, command: &ConfigCommand) -> anyhow::Result<()> {
match command {
ConfigCommand::List {} => {
tracing::debug!("running command: config list");
self.ui.write_str_ln("cuddle-config");
self.ui.write_str(&format!("{}", self.config));
}
}
Ok(())
}
}