refactor: rearrange command dispatcher
This commit is contained in:
parent
ecef639318
commit
6bac32bb7b
1 changed files with 29 additions and 18 deletions
39
src/lib.rs
39
src/lib.rs
|
@ -150,24 +150,35 @@ pub async fn run(ctx: Ctx) -> color_eyre::Result<()> {
|
||||||
Command::Init => Err(eyre!("Config file already exists. Not overwriting it.")),
|
Command::Init => Err(eyre!("Config file already exists. Not overwriting it.")),
|
||||||
Command::Check => check::run(ctx).await,
|
Command::Check => check::run(ctx).await,
|
||||||
Command::Import => todo!("import"),
|
Command::Import => todo!("import"),
|
||||||
Command::Trello(TrelloCommand::Board(TrelloBoardCommand::List { dump })) => {
|
Command::Trello(trello) => match trello {
|
||||||
trello::boards::list(ctx, dump).await
|
TrelloCommand::Board(board) => match board {
|
||||||
|
TrelloBoardCommand::List { dump } => {
|
||||||
|
nextcloud::board::list(ctx, dump).await
|
||||||
}
|
}
|
||||||
Command::Nextcloud(NextcloudCommand::Board(NextcloudBoardCommand::List {
|
},
|
||||||
dump,
|
},
|
||||||
})) => nextcloud::board::list(ctx, dump).await,
|
Command::Nextcloud(nextcloud) => match nextcloud {
|
||||||
Command::Nextcloud(NextcloudCommand::Stack(NextcloudStackCommand::List {
|
NextcloudCommand::Board(board) => match board {
|
||||||
dump,
|
NextcloudBoardCommand::List { dump } => {
|
||||||
})) => nextcloud::stack::list(ctx, dump).await,
|
nextcloud::board::list(ctx, dump).await
|
||||||
Command::Nextcloud(NextcloudCommand::Card(NextcloudCardCommand::List {
|
}
|
||||||
dump,
|
},
|
||||||
stack_id,
|
NextcloudCommand::Stack(stack) => match stack {
|
||||||
})) => nextcloud::card::list(ctx, dump, stack_id.into()).await,
|
NextcloudStackCommand::List { dump } => {
|
||||||
Command::Nextcloud(NextcloudCommand::Card(NextcloudCardCommand::Get {
|
nextcloud::stack::list(ctx, dump).await
|
||||||
|
}
|
||||||
|
},
|
||||||
|
NextcloudCommand::Card(card) => match card {
|
||||||
|
NextcloudCardCommand::List { dump, stack_id } => {
|
||||||
|
nextcloud::card::list(ctx, dump, stack_id.into()).await
|
||||||
|
}
|
||||||
|
NextcloudCardCommand::Get {
|
||||||
dump,
|
dump,
|
||||||
stack_id,
|
stack_id,
|
||||||
card_id,
|
card_id,
|
||||||
})) => nextcloud::card::get(ctx, dump, stack_id.into(), card_id.into()).await,
|
} => nextcloud::card::get(ctx, dump, stack_id.into(), card_id.into()).await,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue