trello-to-deck/src/nextcloud/stack.rs

20 lines
508 B
Rust
Raw Normal View History

//
use crate::{p, FullCtx};
pub async fn list(ctx: FullCtx, dump: bool) -> color_eyre::Result<()> {
let api_result = ctx
.deck_client()
.get_stacks(ctx.cfg.nextcloud.board_id)
.await;
if dump {
p!(ctx.prt, "{}", api_result.text);
} else {
let mut stacks = api_result.result?;
stacks.sort_by_key(|stack| stack.order);
stacks
.iter()
.for_each(|stack| p!(ctx.prt, "{}:{}", stack.id, stack.title));
}
Ok(())
}