53 lines
1.4 KiB
Rust
53 lines
1.4 KiB
Rust
//
|
|
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;
|
|
|
|
#[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,
|
|
}
|