Skip to content

Commit

Permalink
Improve help description
Browse files Browse the repository at this point in the history
  • Loading branch information
locka99 committed Jan 22, 2020
1 parent 2786970 commit 93d0b02
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions samples/simple-client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ struct Args {
url: String,
}

const DEFAULT_URL : &str= "opc.tcp://localhost:4855";

fn main() -> Result<(), Box<dyn std::error::Error>> {
// Read command line arguments
let mut args = pico_args::Arguments::from_env();
let args = Args {
help: args.contains(["-h", "--help"]),
url: args.opt_value_from_str("--url")?.unwrap_or(String::from("opc.tcp://localhost:4855")),
url: args.opt_value_from_str("--url")?.unwrap_or(String::from(DEFAULT_URL)),
};

if args.help {
println!(r#"Simple Client"#);
println!(r#"Usage: simple-client --url [url]"#);
println!("Simple Client");
println!("Usage: simple-client --url [url]");
println!(" -h, --help Show help");
println!(" --url [url] Url to connect to (default: {})", DEFAULT_URL);
}
else {
// Optional - enable OPC UA logging
Expand Down

0 comments on commit 93d0b02

Please sign in to comment.