Clean struct-opt derive
This commit is contained in:
1 parent
eb7388794a
commit
b6c6dd6532
10 files changed
+49
-61
No files matched your search
+4
-3
@@ -9,11 +9,13 @@ license = "MIT/Apache-2.0"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
# cli core
|
||||||
|
clap = {version = "3.0.14", features = ["derive"]}
|
||||||
thiserror = "1.0.30"
|
thiserror = "1.0.30"
|
||||||
|
wasm-bindgen-cli-support = "0.2.79"
|
||||||
|
# features
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
fern = { version = "0.6.0", features = ["colored"] }
|
fern = { version = "0.6.0", features = ["colored"] }
|
||||||
wasm-bindgen-cli-support = "0.2.79"
|
|
||||||
anyhow = "1.0.53"
|
|
||||||
serde = { version = "1.0.136", features = ["derive"] }
|
serde = { version = "1.0.136", features = ["derive"] }
|
||||||
serde_json = "1.0.79"
|
serde_json = "1.0.79"
|
||||||
toml = "0.5.8"
|
toml = "0.5.8"
|
||||||
@@ -29,7 +31,6 @@ tokio = { version = "1.16.1", features = ["full"] }
|
|||||||
atty = "0.2.14"
|
atty = "0.2.14"
|
||||||
regex = "1.5.4"
|
regex = "1.5.4"
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
clap = "3.0.14"
|
|
||||||
|
|
||||||
axum = { version = "0.4.5", features = ["ws", "headers"] }
|
axum = { version = "0.4.5", features = ["ws", "headers"] }
|
||||||
tower-http = { version = "0.2.2", features = ["fs", "trace"] }
|
tower-http = { version = "0.2.2", features = ["fs", "trace"] }
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
use std::{io::Write, path::PathBuf};
|
use super::*;
|
||||||
|
|
||||||
use crate::{cfg::ConfigOptsBuild, gen_page};
|
|
||||||
use structopt::StructOpt;
|
|
||||||
|
|
||||||
/// Build the Rust WASM app and all of its assets.
|
/// Build the Rust WASM app and all of its assets.
|
||||||
#[derive(Clone, Debug, StructOpt)]
|
#[derive(Clone, Debug, Parser)]
|
||||||
#[structopt(name = "build")]
|
#[structopt(name = "build")]
|
||||||
pub struct Build {
|
pub struct Build {
|
||||||
#[structopt(flatten)]
|
#[structopt(flatten)]
|
||||||
@@ -15,7 +13,7 @@ impl Build {
|
|||||||
pub fn build(self) -> anyhow::Result<()> {
|
pub fn build(self) -> anyhow::Result<()> {
|
||||||
let mut crate_config = crate::CrateConfig::new()?;
|
let mut crate_config = crate::CrateConfig::new()?;
|
||||||
|
|
||||||
// change the relase state.
|
// change the release state.
|
||||||
crate_config.with_release(self.build.release);
|
crate_config.with_release(self.build.release);
|
||||||
|
|
||||||
if self.build.example.is_some() {
|
if self.build.example.is_some() {
|
||||||
|
|||||||
+3
-6
@@ -1,10 +1,7 @@
|
|||||||
use std::path::PathBuf;
|
use super::*;
|
||||||
use structopt::StructOpt;
|
|
||||||
|
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
/// Config options for the build system.
|
/// Config options for the build system.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, StructOpt)]
|
#[derive(Clone, Debug, Default, Deserialize, Parser)]
|
||||||
pub struct ConfigOptsBuild {
|
pub struct ConfigOptsBuild {
|
||||||
/// The index HTML file to drive the bundling process [default: index.html]
|
/// The index HTML file to drive the bundling process [default: index.html]
|
||||||
#[structopt(parse(from_os_str))]
|
#[structopt(parse(from_os_str))]
|
||||||
@@ -24,7 +21,7 @@ pub struct ConfigOptsBuild {
|
|||||||
pub platform: String,
|
pub platform: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, StructOpt)]
|
#[derive(Clone, Debug, Default, Deserialize, Parser)]
|
||||||
pub struct ConfigOptsServe {
|
pub struct ConfigOptsServe {
|
||||||
/// The index HTML file to drive the bundling process [default: index.html]
|
/// The index HTML file to drive the bundling process [default: index.html]
|
||||||
#[structopt(parse(from_os_str))]
|
#[structopt(parse(from_os_str))]
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
use std::{
|
use super::*;
|
||||||
fs::remove_dir_all,
|
|
||||||
path::PathBuf,
|
|
||||||
process::{Command, Stdio},
|
|
||||||
};
|
|
||||||
|
|
||||||
use structopt::StructOpt;
|
|
||||||
|
|
||||||
/// Build the Rust WASM app and all of its assets.
|
/// Build the Rust WASM app and all of its assets.
|
||||||
#[derive(Clone, Debug, StructOpt)]
|
#[derive(Clone, Debug, Parser)]
|
||||||
#[structopt(name = "clean")]
|
#[structopt(name = "clean")]
|
||||||
pub struct Clean {}
|
pub struct Clean {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
use std::{fs::File, io::Write};
|
use super::*;
|
||||||
|
|
||||||
use serde::Deserialize;
|
|
||||||
use structopt::StructOpt;
|
|
||||||
|
|
||||||
/// Build the Rust WASM app and all of its assets.
|
/// Build the Rust WASM app and all of its assets.
|
||||||
#[derive(Clone, Debug, Deserialize, StructOpt)]
|
#[derive(Clone, Debug, Deserialize, Parser)]
|
||||||
#[structopt(name = "config")]
|
#[structopt(name = "config")]
|
||||||
pub enum Config {
|
pub enum Config {
|
||||||
/// Init `Dioxus.toml` for project/folder.
|
/// Init `Dioxus.toml` for project/folder.
|
||||||
|
|||||||
+1
-12
@@ -1,15 +1,4 @@
|
|||||||
use std::{
|
use super::*;
|
||||||
fs::File,
|
|
||||||
io::{Read, Write},
|
|
||||||
path::PathBuf,
|
|
||||||
process::{Command, Stdio},
|
|
||||||
};
|
|
||||||
|
|
||||||
use regex::Regex;
|
|
||||||
use serde::Deserialize;
|
|
||||||
use structopt::StructOpt;
|
|
||||||
|
|
||||||
use crate::{error::Result, Error};
|
|
||||||
|
|
||||||
/// Build the Rust WASM app and all of its assets.
|
/// Build the Rust WASM app and all of its assets.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, StructOpt)]
|
#[derive(Clone, Debug, Default, Deserialize, StructOpt)]
|
||||||
|
|||||||
+26
-7
@@ -1,5 +1,3 @@
|
|||||||
use structopt::StructOpt;
|
|
||||||
|
|
||||||
pub mod build;
|
pub mod build;
|
||||||
pub mod cfg;
|
pub mod cfg;
|
||||||
pub mod clean;
|
pub mod clean;
|
||||||
@@ -8,17 +6,38 @@ pub mod create;
|
|||||||
pub mod serve;
|
pub mod serve;
|
||||||
pub mod translate;
|
pub mod translate;
|
||||||
|
|
||||||
|
use std::{io::Write, path::PathBuf};
|
||||||
|
use crate::{cfg::ConfigOptsBuild, gen_page};
|
||||||
|
use clap::{Parser};
|
||||||
|
use serde::Deserialize;
|
||||||
|
use std::{
|
||||||
|
fs::remove_dir_all,
|
||||||
|
process::{Command, Stdio},
|
||||||
|
};
|
||||||
|
use std::{fs::File};
|
||||||
|
use std::{
|
||||||
|
io::{Read},
|
||||||
|
};
|
||||||
|
use regex::Regex;
|
||||||
|
use crate::{error::Result, Error};
|
||||||
|
use crate::{cfg::ConfigOptsServe, server, CrateConfig};
|
||||||
|
use html_parser::Dom;
|
||||||
|
use html_parser::Element;
|
||||||
|
use html_parser::Node;
|
||||||
|
use std::fmt::{Display, Formatter};
|
||||||
|
use std::process::exit;
|
||||||
|
|
||||||
/// Build, bundle, & ship your Dioxus app.
|
/// Build, bundle, & ship your Dioxus app.
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
#[derive(StructOpt)]
|
#[derive(Parser, Debug)]
|
||||||
#[structopt(name = "dioxus")]
|
#[clap(name = "dioxus")]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
#[structopt(subcommand)]
|
#[clap(subcommand)]
|
||||||
pub action: Commands,
|
pub action: Commands,
|
||||||
|
|
||||||
/// Enable verbose logging.
|
/// Enable verbose logging.
|
||||||
#[structopt(short)]
|
#[clap(short)]
|
||||||
pub v: bool,
|
pub v: bool,
|
||||||
//
|
//
|
||||||
// // note: dioxus is still roughly compatible with trunk
|
// // note: dioxus is still roughly compatible with trunk
|
||||||
@@ -27,7 +46,7 @@ pub struct Cli {
|
|||||||
// pub config: Option<PathBuf>,
|
// pub config: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(StructOpt)]
|
#[derive(Parser)]
|
||||||
pub enum Commands {
|
pub enum Commands {
|
||||||
/// Build the Rust WASM app and all of its assets.
|
/// Build the Rust WASM app and all of its assets.
|
||||||
Build(build::Build),
|
Build(build::Build),
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
use crate::{cfg::ConfigOptsServe, gen_page, server, CrateConfig};
|
use super::*;
|
||||||
use std::{io::Write, path::PathBuf, process::{Command, Stdio}};
|
|
||||||
use structopt::StructOpt;
|
|
||||||
|
|
||||||
/// Run the WASM project on dev-server
|
/// Run the WASM project on dev-server
|
||||||
#[derive(Clone, Debug, StructOpt)]
|
#[derive(Clone, Debug, Parser)]
|
||||||
#[structopt(name = "serve")]
|
#[structopt(name = "serve")]
|
||||||
pub struct Serve {
|
pub struct Serve {
|
||||||
#[structopt(flatten)]
|
#[structopt(flatten)]
|
||||||
|
|||||||
@@ -1,16 +1,7 @@
|
|||||||
use anyhow::Result;
|
use super::*;
|
||||||
use html_parser::Dom;
|
|
||||||
use html_parser::Element;
|
|
||||||
use html_parser::Node;
|
|
||||||
#[allow(unused_imports)]
|
|
||||||
use std::fmt::{Display, Formatter};
|
|
||||||
use std::io::Read;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::process::exit;
|
|
||||||
use structopt::StructOpt;
|
|
||||||
|
|
||||||
/// Build the Rust WASM app and all of its assets.
|
/// Build the Rust WASM app and all of its assets.
|
||||||
#[derive(Clone, Debug, StructOpt)]
|
#[derive(Clone, Debug, Parser)]
|
||||||
#[structopt(name = "translate")]
|
#[structopt(name = "translate")]
|
||||||
pub struct Translate {
|
pub struct Translate {
|
||||||
/// Activate debug mode
|
/// Activate debug mode
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#[test]
|
||||||
|
fn ready() {
|
||||||
|
println!("Compiled successfully!")
|
||||||
|
}
|
||||||
Reference in new issue
Block a user