mirror of
https://github.com/winapps-org/winapps.git
synced 2025-08-06 02:38:26 +02:00
Add basic cli and config file parsing
This commit is contained in:
@@ -7,4 +7,5 @@ default-run = "winapps-cli"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clap = "4.3.11"
|
||||
winapps = { path = "../winapps" }
|
||||
|
@@ -1,3 +1,33 @@
|
||||
fn main() {
|
||||
println!("Test lib: {}", winapps::add(1, 2));
|
||||
use clap::Command;
|
||||
|
||||
fn cli() -> Command {
|
||||
Command::new("winapps-cli")
|
||||
.about("The winapps-cli is a command line interface for winapps")
|
||||
.subcommand_required(true)
|
||||
.arg_required_else_help(true)
|
||||
.allow_external_subcommands(true)
|
||||
.subcommand(Command::new("check").about("Checks remote connection"))
|
||||
.subcommand(Command::new("connect").about("Connects to remote"))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let cli = cli();
|
||||
let matches = cli.clone().get_matches();
|
||||
|
||||
match matches.subcommand() {
|
||||
Some(("check", _)) => {
|
||||
println!("Checking remote connection");
|
||||
|
||||
let _config = winapps::load_config(None);
|
||||
}
|
||||
Some(("connect", _)) => {
|
||||
println!("Connecting to remote");
|
||||
}
|
||||
Some((_, _)) => {
|
||||
cli.about("Command not found try existing ones!")
|
||||
.print_help()
|
||||
.unwrap();
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user