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

20 lines
530 B
Rust
Raw Normal View History

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