bular 0.0.2

CLI for managing Bular deployments
//! Bular is a CLI for managing Bular deployments.
//!
//! https://bular.cloud

use clap::Parser;

pub mod api;
mod bular_json;
mod cli;
pub mod config;
pub mod lambda;
pub mod manifest;
pub mod rust;

#[tokio::main]
async fn main() {
    // tracing_subscriber::fmt()
    //     .with_env_filter(EnvFilter::from_default_env())
    //     .init();
    // std::panic::set_hook(Box::new(move |panic| tracing::error!("{panic}")));

    let cli = cli::Cli::parse();
    if !cli.cwd.exists() {
        eprintln!("The directory {:?} does not exist.", cli.cwd);
        std::process::exit(1);
    }

    match cli.command {
        cli::Commands::Login(c) => c.run(cli.server).await,
        cli::Commands::Logout(c) => c.run(cli.server).await,
        cli::Commands::Whoami(c) => c.run(cli.server).await,
        cli::Commands::Deploy(c) => c.run(cli.cwd, cli.server).await,
        cli::Commands::Dev(c) => c.run().await,
        cli::Commands::New(c) => c.run(cli.cwd).await,
        cli::Commands::Init(c) => c.run(cli.cwd).await,
    }
}