trello-to-deck/src/trello/member.rs
Paul Campbell 7af4dae96d
Some checks failed
Test / build (map[name:stable]) (push) Successful in 1m51s
Test / build (map[name:nightly]) (push) Successful in 2m4s
Release Please / Release-plz (push) Failing after 20s
refactor: Execute::execute passes itself by ref
2024-12-16 06:41:29 +00:00

33 lines
925 B
Rust

//
use clap::Parser;
use crate::execute::Execute;
use crate::{p, FullCtx};
#[derive(Parser, Debug)]
pub(crate) enum TrelloMemberCommand {
Get {
#[clap(long, action = clap::ArgAction::SetTrue)]
dump: bool,
},
}
impl Execute for TrelloMemberCommand {
async fn execute(&self, ctx: &FullCtx) -> color_eyre::Result<()> {
match self {
Self::Get { dump } => {
let api_result = ctx.trello_client().boards().await;
if *dump {
p!(ctx.prt, "{}", api_result.text);
} else {
let mut boards = api_result.result?;
boards.sort_by(|a, b| a.name.cmp(&b.name));
boards.into_iter().for_each(|board| {
p!(ctx.prt, "{}:{}", board.id, board.name);
});
}
Ok(())
}
}
}
}