Skip to main content

wekan_cli/commands/
custom_field_items.rs

1mod create;
2mod delete;
3mod update;
4use crate::{
5    client::WekanClientFactory, command_result::CommandSuccess, credentials::CredentialStore,
6    error::AppError, input::ConfirmationProvider,
7};
8use clap::{Args, Subcommand};
9#[derive(Debug, Args)]
10pub struct CustomFieldItemArgs {
11    #[command(subcommand)]
12    pub command: CustomFieldItemCommand,
13}
14#[derive(Debug, Subcommand)]
15pub enum CustomFieldItemCommand {
16    /// Create custom-field dropdown items.
17    Create(create::CreateArgs),
18    /// Update custom-field dropdown items.
19    Update(update::UpdateArgs),
20    /// Permanently delete custom-field dropdown items.
21    Delete(delete::DeleteArgs),
22}
23pub(crate) async fn dispatch(
24    command: CustomFieldItemCommand,
25    factory: &WekanClientFactory,
26    store: &dyn CredentialStore,
27    confirmation: &dyn ConfirmationProvider,
28) -> Result<CommandSuccess, AppError> {
29    match command {
30        CustomFieldItemCommand::Create(args) => create::execute(args, factory, store).await,
31        CustomFieldItemCommand::Update(args) => update::execute(args, factory, store).await,
32        CustomFieldItemCommand::Delete(args) => {
33            delete::execute(args, factory, store, confirmation).await
34        }
35    }
36}
37use super::custom_fields::{exact_json, non_empty};