2024-12-08 17:23:54 +00:00
|
|
|
//
|
|
|
|
use clap::Parser;
|
2024-12-04 19:37:39 +00:00
|
|
|
|
2024-12-16 22:17:16 +00:00
|
|
|
use crate::nextcloud::board::NextcloudBoardCommand;
|
2024-12-08 17:23:54 +00:00
|
|
|
use crate::{
|
|
|
|
execute::Execute,
|
|
|
|
nextcloud::{
|
2024-12-14 08:05:34 +00:00
|
|
|
card::NextcloudCardCommand,
|
2024-12-11 20:46:10 +00:00
|
|
|
deck::NextcloudDeckCommand,
|
2024-12-19 07:05:10 +00:00
|
|
|
model::{NextcloudHostname, NextcloudPassword, NextcloudUsername},
|
2024-12-08 17:23:54 +00:00
|
|
|
stack::NextcloudStackCommand,
|
|
|
|
},
|
|
|
|
FullCtx,
|
2024-11-30 18:04:48 +00:00
|
|
|
};
|
2024-11-30 11:30:36 +00:00
|
|
|
|
2024-12-16 22:17:16 +00:00
|
|
|
pub(crate) mod board;
|
2024-12-08 22:15:23 +00:00
|
|
|
pub(crate) mod card;
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) mod client;
|
2024-12-11 20:46:10 +00:00
|
|
|
pub(crate) mod deck;
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) mod model;
|
|
|
|
mod stack;
|
2024-11-30 11:30:36 +00:00
|
|
|
|
2024-12-14 08:02:19 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests;
|
2024-11-30 11:30:36 +00:00
|
|
|
|
2024-12-08 17:23:54 +00:00
|
|
|
#[derive(Parser, Debug)]
|
2024-12-15 20:07:34 +00:00
|
|
|
pub enum NextcloudCommand {
|
2024-12-08 17:23:54 +00:00
|
|
|
#[clap(subcommand)]
|
2024-12-11 20:46:10 +00:00
|
|
|
Deck(NextcloudDeckCommand),
|
2024-12-08 17:23:54 +00:00
|
|
|
#[clap(subcommand)]
|
2024-12-16 22:17:16 +00:00
|
|
|
Board(NextcloudBoardCommand),
|
|
|
|
#[clap(subcommand)]
|
2024-12-08 17:23:54 +00:00
|
|
|
Stack(NextcloudStackCommand),
|
|
|
|
#[clap(subcommand)]
|
|
|
|
Card(NextcloudCardCommand),
|
|
|
|
}
|
|
|
|
impl Execute for NextcloudCommand {
|
2024-12-15 20:07:34 +00:00
|
|
|
async fn execute(&self, ctx: &FullCtx) -> color_eyre::Result<()> {
|
2024-12-08 17:23:54 +00:00
|
|
|
match self {
|
2024-12-11 20:46:10 +00:00
|
|
|
NextcloudCommand::Deck(cmd) => cmd.execute(ctx).await,
|
2024-12-16 22:17:16 +00:00
|
|
|
NextcloudCommand::Board(cmd) => cmd.execute(ctx).await,
|
2024-12-08 17:23:54 +00:00
|
|
|
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,
|
|
|
|
}
|