Merge branch 'master' into jk/formatting-and-extension

This commit is contained in:
Jonathan Kelley committed 2022-12-25 23:38:33 -05:00
commit fa52a8f71a
59 files changed
+6691 -252

No files matched your search

+24 -8
View File
@@ -1,50 +1,66 @@
use clap::Parser;
use dioxus_cli::*;
use dioxus_cli::{plugin::PluginManager, *};
use std::process::exit;
#[tokio::main]
async fn main() -> Result<()> {
let args = Cli::parse();
set_up_logging();
let dioxus_config = DioxusConfig::load().unwrap_or(DioxusConfig::default());
let plugin_state = PluginManager::init(dioxus_config.plugin);
if let Err(e) = plugin_state {
log::error!("🚫 Plugin system initialization failed: {e}");
exit(1);
}
match args.action {
Commands::Translate(opts) => {
if let Err(e) = opts.translate() {
log::error!("translate error: {}", e);
log::error!("🚫 Translate failed: {}", e);
exit(1);
}
}
Commands::Build(opts) => {
if let Err(e) = opts.build() {
log::error!("build error: {}", e);
log::error!("🚫 Build project failed: {}", e);
exit(1);
}
}
Commands::Clean(opts) => {
if let Err(e) = opts.clean() {
log::error!("clean error: {}", e);
log::error!("🚫 Clean project failed: {}", e);
exit(1);
}
}
Commands::Serve(opts) => {
if let Err(e) = opts.serve().await {
log::error!("serve error: {}", e);
log::error!("🚫 Serve startup failed: {}", e);
exit(1);
}
}
Commands::Create(opts) => {
if let Err(e) = opts.create() {
log::error!("create error: {}", e);
log::error!("🚫 Create project failed: {}", e);
exit(1);
}
}
Commands::Config(opts) => {
if let Err(e) = opts.config() {
log::error!("config error: {}", e);
exit(1);
}
}
Commands::Tool(opts) => {
if let Err(e) = opts.tool().await {
Commands::Plugin(opts) => {
if let Err(e) = opts.plugin().await {
log::error!("tool error: {}", e);
}
}