wasmer_cli/commands/app/
get.rs

1//! Get information about an edge app.
2
3use wasmer_backend_api::types::DeployApp;
4
5use super::util::AppIdentOpts;
6
7use crate::{
8    commands::AsyncCliCommand, config::WasmerEnv, opts::ItemFormatOpts, utils::render::ItemFormat,
9};
10
11/// Retrieve detailed informations about an app
12#[derive(clap::Parser, Debug)]
13pub struct CmdAppGet {
14    #[clap(flatten)]
15    pub env: WasmerEnv,
16
17    #[clap(flatten)]
18    pub fmt: ItemFormatOpts,
19
20    #[clap(flatten)]
21    pub ident: AppIdentOpts,
22}
23
24#[async_trait::async_trait]
25impl AsyncCliCommand for CmdAppGet {
26    type Output = DeployApp;
27
28    async fn run_async(self) -> Result<DeployApp, anyhow::Error> {
29        let client = self.env.client()?;
30        let (_ident, app) = self.ident.load_app(&client).await?;
31
32        println!(
33            "{}",
34            self.fmt.get_with_default(ItemFormat::Yaml).render(&app)
35        );
36
37        Ok(app)
38    }
39}