trello-to-deck/src/nextcloud/mod.rs

54 lines
1.4 KiB
Rust
Raw Normal View History

//
use clap::Parser;
use crate::nextcloud::board::NextcloudBoardCommand;
use crate::{
execute::Execute,
nextcloud::{
card::NextcloudCardCommand,
deck::NextcloudDeckCommand,
model::{NextcloudHostname, NextcloudPassword, NextcloudUsername},
stack::NextcloudStackCommand,
},
FullCtx,
};
pub(crate) mod board;
pub(crate) mod card;
pub(crate) mod client;
pub(crate) mod deck;
pub(crate) mod model;
mod stack;
2024-12-14 08:02:19 +00:00
#[cfg(test)]
mod tests;
#[derive(Parser, Debug)]
pub enum NextcloudCommand {
#[clap(subcommand)]
Deck(NextcloudDeckCommand),
#[clap(subcommand)]
Board(NextcloudBoardCommand),
#[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::Board(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,
}