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