topcoat-cli 0.8.1

A modular, batteries-included Rust web framework for server-rendered apps.
Documentation
#![cfg_attr(docsrs, feature(doc_cfg))]

mod asset;
mod common;
mod dev;
mod fmt;
mod ui;

use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(name = "topcoat")]
pub struct TopcoatCli {
    #[command(subcommand)]
    command: Command,
}

impl TopcoatCli {
    pub async fn run(self) {
        match self.command {
            Command::Ui(cmd) => cmd.run(),
            Command::Fmt(cmd) => cmd.run().await,
            Command::Dev(cmd) => cmd.run().await,
            Command::Asset(cmd) => cmd.run().await,
        }
    }
}

#[derive(Subcommand)]
enum Command {
    /// Start a development server
    Dev(dev::DevCommand),
    /// Format topcoat `view!` macros
    Fmt(fmt::FmtCommand),
    /// Inspect assets embedded in the binary
    Asset(asset::AssetCommand),
    /// Manage premade UI components in your project
    Ui(ui::UiCommand),
}

pub async fn run() {
    common::version::warn_on_mismatch();
    TopcoatCli::parse().run().await;
}