mod dashboard;
mod ports;
mod preview;
mod run;
mod sync;
mod theme;
mod vsix;
mod widgets;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "vkit", version, about = "Fast Rust CLI companion for vkit")]
struct Cli {
#[command(subcommand)]
command: Option<Command>,
}
#[derive(Subcommand)]
enum Command {
Port,
Run,
Vsix,
Sync,
Preview,
}
fn main() {
let cli = Cli::parse();
let is_light = matches!(
termbg::theme(std::time::Duration::from_millis(100)),
Ok(termbg::Theme::Light)
);
theme::init(is_light);
let result = match cli.command {
Some(Command::Port) => ports::run(),
Some(Command::Run) => run::run(),
Some(Command::Vsix) => vsix::run(),
Some(Command::Sync) => sync::run(),
Some(Command::Preview) => preview::run(),
None => dashboard::run(),
};
if let Err(err) = result {
eprintln!("错误:{err:#}");
std::process::exit(1);
}
}