1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
mod login;
mod logout;
mod whoami;

pub use login::*;
pub use whoami::*;

use super::AsyncCliCommand;

/// Manage your .
#[derive(clap::Subcommand, Debug)]
pub enum CmdAuth {
    Login(login::Login),
    Logout(logout::Logout),
    Whoami(whoami::Whoami),
}

#[async_trait::async_trait]
impl AsyncCliCommand for CmdAuth {
    type Output = ();

    async fn run_async(self) -> Result<Self::Output, anyhow::Error> {
        match self {
            CmdAuth::Login(l) => l.run_async().await,
            CmdAuth::Logout(l) => l.run_async().await,
            CmdAuth::Whoami(w) => w.run_async().await,
        }
    }
}