23 lines
577 B
Rust
23 lines
577 B
Rust
|
//
|
||
|
use kxio::net::Net;
|
||
|
|
||
|
use crate::{p, AppConfig, Ctx};
|
||
|
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_boards().await;
|
||
|
if dump {
|
||
|
p!("{}", apiresult.text);
|
||
|
} else {
|
||
|
let mut boards = apiresult.result?;
|
||
|
boards.sort_by_key(|stack| stack.title.clone());
|
||
|
boards
|
||
|
.iter()
|
||
|
.for_each(|stack| p!("{}:{}", stack.id, stack.title));
|
||
|
}
|
||
|
Ok(())
|
||
|
}
|