soroban_cli/commands/plugin/
mod.rs

1use crate::commands::global;
2use clap::Parser;
3
4pub mod default;
5pub mod ls;
6pub mod search;
7
8#[derive(Debug, Parser)]
9pub enum Cmd {
10    /// Search for CLI plugins using GitHub
11    Search(search::Cmd),
12
13    /// List installed plugins
14    Ls(ls::Cmd),
15}
16
17#[derive(thiserror::Error, Debug)]
18pub enum Error {
19    #[error(transparent)]
20    Search(#[from] search::Error),
21
22    #[error(transparent)]
23    Ls(#[from] ls::Error),
24}
25
26impl Cmd {
27    pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> {
28        match self {
29            Cmd::Search(cmd) => cmd.run(global_args).await?,
30            Cmd::Ls(cmd) => cmd.run()?,
31        }
32        Ok(())
33    }
34}