From 0047f5d0efc12b9a16cd7ae522930e18c6546cc5 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 17 Dec 2024 07:00:36 +0000 Subject: [PATCH] refactor: Remove command 'nextcloud card list' Replaced by 'nextcloud stack get'. --- README.md | 1 + src/nextcloud/card.rs | 29 ----------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/README.md b/README.md index c6e7aee..05642f3 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ As part of building the import server, the following commands exercise each oper - [x] nextcloud deck get - includes list of boards - [x] nextcloud board get - includes list of stacks - [x] nextcloud stack get - includes list of cards +- [ ] nextcloud card get - shows card title - [ ] nextcloud card create - [ ] nextcloud card add-label - [ ] nextcloud card add-attachment \ No newline at end of file diff --git a/src/nextcloud/card.rs b/src/nextcloud/card.rs index ecc1c4e..977996e 100644 --- a/src/nextcloud/card.rs +++ b/src/nextcloud/card.rs @@ -10,11 +10,6 @@ use crate::{ #[derive(Parser, Debug)] pub enum NextcloudCardCommand { - List { - #[clap(long, action = clap::ArgAction::SetTrue)] - dump: bool, - stack_id: i64, - }, Get { #[clap(long, action = clap::ArgAction::SetTrue)] dump: bool, @@ -43,9 +38,6 @@ pub enum NextcloudCardCommand { impl Execute for NextcloudCardCommand { async fn execute(&self, ctx: &FullCtx) -> color_eyre::Result<()> { match self { - Self::List { dump, stack_id } => { - list(ctx, *dump, NextcloudStackId::from(*stack_id)).await - } Self::Get { dump, stack_id, @@ -97,27 +89,6 @@ impl Execute for NextcloudCardCommand { } } -pub(crate) async fn list( - ctx: &FullCtx, - dump: bool, - stack_id: NextcloudStackId, -) -> color_eyre::Result<()> { - let api_result = ctx - .deck_client() - .get_stack(ctx.cfg.nextcloud.board_id, stack_id) - .await; - if dump { - p!(ctx.prt, "{}", api_result.text); - } else { - let mut cards = api_result.result?.cards; - cards.sort_by_key(|card| card.title.clone()); - cards - .iter() - .for_each(|card| p!(ctx.prt, "{}:{}", card.id, card.title)); - } - Ok(()) -} - pub(crate) async fn get( ctx: &FullCtx, dump: bool,