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