refactor: move config list

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-08-01 17:01:00 +02:00
parent e51454088e
commit ae9073bf0b
8 changed files with 93 additions and 58 deletions

View File

@@ -0,0 +1,27 @@
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(())
}
}