taskfast_cli/cmd/
platform.rs1use clap::{Parser, Subcommand};
10use serde_json::json;
11
12use super::{CmdResult, Ctx};
13use crate::envelope::Envelope;
14
15use taskfast_client::map_api_error;
16
17#[derive(Debug, Subcommand)]
18pub enum Command {
19 Config,
21}
22
23#[derive(Debug, Parser)]
24pub struct Args;
25
26pub async fn run(ctx: &Ctx, cmd: Command) -> CmdResult {
27 match cmd {
28 Command::Config => config(ctx).await,
29 }
30}
31
32async fn config(ctx: &Ctx) -> CmdResult {
33 let client = ctx.client()?;
34 let resp = match client.inner().get_platform_config().await {
35 Ok(v) => v.into_inner(),
36 Err(e) => return Err(map_api_error(e).await.into()),
37 };
38 Ok(Envelope::success(
39 ctx.environment,
40 ctx.dry_run,
41 json!({ "config": resp }),
42 ))
43}