Add commandline args to switch gui mode
This commit is contained in:
parent
7569d296b1
commit
4511c8f953
5 changed files with 34 additions and 2 deletions
|
@ -10,6 +10,7 @@ license = "MIT OR Apache-2.0"
|
||||||
repository = "https://forgejo.fireturlte.net/lazy-supplements"
|
repository = "https://forgejo.fireturlte.net/lazy-supplements"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
|
clap = { version = "4.5.38", features = ["derive"] }
|
||||||
dioxus = { version = "0.6.0", features = [] }
|
dioxus = { version = "0.6.0", features = [] }
|
||||||
lazy-supplements-core.path = "lazy-supplements-core"
|
lazy-supplements-core.path = "lazy-supplements-core"
|
||||||
libp2p = { version = "0.55.0", features = ["macros", "mdns", "noise", "ping", "tcp", "tokio", "yamux" ] }
|
libp2p = { version = "0.55.0", features = ["macros", "mdns", "noise", "ping", "tcp", "tokio", "yamux" ] }
|
||||||
|
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
||||||
# 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]
|
||||||
|
clap.workspace = true
|
||||||
dioxus.workspace = true
|
dioxus.workspace = true
|
||||||
lazy-supplements-examples-core.path = "../core"
|
lazy-supplements-examples-core.path = "../core"
|
||||||
|
|
||||||
|
|
16
examples/desktop/src/cli.rs
Normal file
16
examples/desktop/src/cli.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
use clap::{Args, Parser};
|
||||||
|
|
||||||
|
#[derive(Debug, Parser)]
|
||||||
|
pub struct Cli {
|
||||||
|
#[command(flatten)]
|
||||||
|
pub gui_mode: GuiModeArgs
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Args, Debug)]
|
||||||
|
#[group(required=true, multiple = false)]
|
||||||
|
pub struct GuiModeArgs {
|
||||||
|
#[arg(long)]
|
||||||
|
pub plain: bool,
|
||||||
|
#[arg(long)]
|
||||||
|
pub playful: bool,
|
||||||
|
}
|
|
@ -1,3 +1,17 @@
|
||||||
|
use crate::cli::Cli;
|
||||||
|
use clap::Parser;
|
||||||
|
|
||||||
|
mod cli;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
dioxus::launch(lazy_supplements_examples_core::ui::plain::App);
|
match Cli::try_parse() {
|
||||||
|
Ok(x) => {
|
||||||
|
if x.gui_mode.plain {
|
||||||
|
dioxus::launch(lazy_supplements_examples_core::ui::plain::App);
|
||||||
|
} else if x.gui_mode.playful {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => print!("{e}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ default = []
|
||||||
test = ["lazy-supplements-core/test"]
|
test = ["lazy-supplements-core/test"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.38", features = ["derive"] }
|
clap.workspace = true
|
||||||
dirs = "6.0.0"
|
dirs = "6.0.0"
|
||||||
lazy-supplements-core.workspace = true
|
lazy-supplements-core.workspace = true
|
||||||
libp2p.workspace = true
|
libp2p.workspace = true
|
||||||
|
|
Loading…
Add table
Reference in a new issue