// use clap::Parser; use crate::{ execute::Execute, nextcloud::{ card::NextcloudCardCommand, deck::NextcloudDeckCommand, model::{NextcloudBoardId, NextcloudHostname, NextcloudPassword, NextcloudUsername}, stack::NextcloudStackCommand, }, FullCtx, }; pub(crate) mod card; pub(crate) mod client; pub(crate) mod deck; pub(crate) mod model; mod stack; #[cfg(test)] mod tests; pub(crate) struct DeckClient<'ctx> { ctx: &'ctx FullCtx, hostname: &'ctx NextcloudHostname, username: &'ctx NextcloudUsername, password: &'ctx NextcloudPassword, } #[derive(Parser, Debug)] pub enum NextcloudCommand { #[clap(subcommand)] Deck(NextcloudDeckCommand), #[clap(subcommand)] Stack(NextcloudStackCommand), #[clap(subcommand)] Card(NextcloudCardCommand), } impl Execute for NextcloudCommand { async fn execute(&self, ctx: &FullCtx) -> color_eyre::Result<()> { match self { NextcloudCommand::Deck(cmd) => cmd.execute(ctx).await, NextcloudCommand::Stack(cmd) => cmd.execute(ctx).await, NextcloudCommand::Card(cmd) => cmd.execute(ctx).await, } } } #[derive(Clone, Debug, derive_more::From, PartialEq, Eq, PartialOrd, Ord, serde::Deserialize)] pub struct NextcloudConfig { pub(crate) hostname: NextcloudHostname, pub(crate) username: NextcloudUsername, pub(crate) password: NextcloudPassword, pub(crate) board_id: NextcloudBoardId, }