Change to clap and update the app
This commit is contained in:
parent
1a689e7fe9
commit
290353cad3
@ -7,3 +7,5 @@ edition = "2018"
|
|||||||
# 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]
|
||||||
|
structopt = "0.3.13"
|
||||||
|
clap = "2.33.3"
|
33
src/main.rs
33
src/main.rs
@ -1,3 +1,34 @@
|
|||||||
|
use clap::{Arg, App};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world!");
|
let matches = App::new("CUBETIQ Syncer")
|
||||||
|
.version("0.1.0")
|
||||||
|
.author("Sambo Chea <sombochea@cubetiqs.com>")
|
||||||
|
.about("For CUBETIQ software tools")
|
||||||
|
.arg(Arg::with_name("name")
|
||||||
|
.short("n")
|
||||||
|
.long("name")
|
||||||
|
.takes_value(true)
|
||||||
|
.help("Enter your name to register the service."))
|
||||||
|
.arg(Arg::with_name("app_id")
|
||||||
|
.short("id")
|
||||||
|
.long("app_id")
|
||||||
|
.takes_value(true)
|
||||||
|
.help("Enter your app id that register with your service."))
|
||||||
|
.get_matches();
|
||||||
|
|
||||||
|
let name = matches.value_of("name");
|
||||||
|
let app_id = matches.value_of("app_id");
|
||||||
|
|
||||||
|
match name {
|
||||||
|
None => println!("User is not available for use this service!"),
|
||||||
|
Some(s) => println!("Your name is: {}", s)
|
||||||
|
}
|
||||||
|
|
||||||
|
match app_id {
|
||||||
|
None => println!("App Id is required to process the service!"),
|
||||||
|
Some(s) => {
|
||||||
|
println!("Your app id is: {}", s);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user