wasmer_cli/commands/app/version/
activate.rs1use crate::{commands::AsyncCliCommand, config::WasmerEnv, opts::ItemFormatOpts};
2
3#[derive(clap::Parser, Debug)]
5pub struct CmdAppVersionActivate {
6 #[clap(flatten)]
7 pub env: WasmerEnv,
8
9 #[clap(flatten)]
10 pub fmt: ItemFormatOpts,
11
12 pub version: String,
17}
18
19#[async_trait::async_trait]
20impl AsyncCliCommand for CmdAppVersionActivate {
21 type Output = ();
22
23 async fn run_async(self) -> Result<(), anyhow::Error> {
24 let client = self.env.client()?;
25
26 let app = wasmer_backend_api::query::app_version_activate(&client, self.version).await?;
27
28 let Some(version) = &app.active_version else {
29 anyhow::bail!("Failed to activate version: backend did not update version!");
30 };
31
32 eprintln!(
33 "Changed active version of app '{}/{}' from '{}' to '{}' (id: {})",
34 app.owner.global_name,
35 app.name,
36 version.version,
37 version.version,
38 version.id.inner(),
39 );
40
41 Ok(())
42 }
43}