use anyhow::Result;
use clap::{Parser, Subcommand};
mod commands;
use commands::*;
mod client;
mod config;
mod consts;
mod controllers;
mod errors;
mod gql;
mod subscription;
mod table;
mod util;
#[macro_use]
mod macros;
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
#[clap(propagate_version = true)]
pub struct Args {
#[clap(subcommand)]
command: Commands,
#[clap(global = true, long)]
json: bool,
}
commands_enum!(
add,
completion,
connect,
delete,
domain,
docs,
down,
environment,
init,
link,
list,
login,
logout,
logs,
open,
run,
service,
shell,
starship,
status,
unlink,
up,
variables,
whoami
);
#[tokio::main]
async fn main() -> Result<()> {
let cli = Args::parse();
match Commands::exec(cli).await {
Ok(_) => {}
Err(e) => {
if e.root_cause().to_string() == inquire::InquireError::OperationInterrupted.to_string()
{
return Ok(());
}
eprintln!("{:?}", e);
std::process::exit(1);
}
}
Ok(())
}