Commit ad3bd0c0 authored by Andre Julius's avatar Andre Julius
Browse files

Improve help message, auto version setting in clap

The help message now tells the user the ranges of the individual
flags and how they behave in case of an overflow.

Furthermore the version number processed by clap is now fetched
from the Cargo.toml so that's good.
parent 6b2f84da
[package] [package]
name = "slc" name = "slc"
version = "0.3.2" version = "0.3.3"
authors = ["Andre <noromoron@gmail.com>"] authors = ["Andre <noromoron@gmail.com>"]
[dependencies] [dependencies]
......
...@@ -41,56 +41,56 @@ fn main() { ...@@ -41,56 +41,56 @@ fn main() {
let white: u8; let white: u8;
let matches = App::new("simple-led-control") let matches = App::new("simple-led-control")
.version("0.3.2") .version(env!("CARGO_PKG_VERSION"))
.author("Andre Julius <noromoron@gmail.com>") .author("Andre Julius <noromoron@gmail.com>")
.about("Control led strips") .about("Control led strips")
.arg(Arg::with_name("verbose") .arg(Arg::with_name("verbose")
.short("v") .short("v")
.long("verbose") .long("verbose")
.multiple(true) .multiple(true)
.help("Show some debugging prints. Maximum level is 2")) .help("Show some debugging prints. Maximum level is 2."))
.arg(Arg::with_name("sequence") .arg(Arg::with_name("sequence")
.short("s") .short("s")
.long("sequence-number") .long("sequence-number")
.help("Sets the sequence number") .help("Sets the sequence number. Ranges from 0 to 255.")
.takes_value(true)) .takes_value(true))
.arg(Arg::with_name("hostid") .arg(Arg::with_name("hostid")
.short("h") .short("h")
.long("hostid") .long("hostid")
.help("Sets the hostid") .help("Sets the hostid. Ranges from 0 to 255. At a value of 0 the flag is ignored.")
.takes_value(true)) .takes_value(true))
.arg(Arg::with_name("offset") .arg(Arg::with_name("offset")
.short("o") .short("o")
.long("offset") .long("offset")
.help("Sets the offset") .help("Sets the offset. Ranges from 0 to 255.")
.takes_value(true)) .takes_value(true))
.arg(Arg::with_name("number") .arg(Arg::with_name("number")
.short("n") .short("n")
.long("number-of-leds") .long("number-of-leds")
.help("Sets the number of leds to fill") .help("Sets the number of leds to fill. No range limit.")
.takes_value(true)) .takes_value(true))
.arg(Arg::with_name("red") .arg(Arg::with_name("red")
.short("r") .short("r")
.long("color-red") .long("color-red")
.help("Sets the red value") .help("Sets the red value. Ranges from 0 to 255. All values greater 255 are set to 0.")
.takes_value(true)) .takes_value(true))
.arg(Arg::with_name("green") .arg(Arg::with_name("green")
.short("g") .short("g")
.long("color-green") .long("color-green")
.help("Sets the green value") .help("Sets the green value. Ranges from 0 to 255. All values greater 255 are set to 0.")
.takes_value(true)) .takes_value(true))
.arg(Arg::with_name("blue") .arg(Arg::with_name("blue")
.short("b") .short("b")
.long("color-blue") .long("color-blue")
.help("Sets the blue value") .help("Sets the blue value. Ranges from 0 to 255. All values greater 255 are set to 0.")
.takes_value(true)) .takes_value(true))
.arg(Arg::with_name("white") .arg(Arg::with_name("white")
.short("w") .short("w")
.long("color-white") .long("color-white")
.help("Sets the white value") .help("Sets the white value. Ranges from 0 to 255. All values greater 255 are set to 0.")
.takes_value(true)) .takes_value(true))
.arg(Arg::with_name("address") .arg(Arg::with_name("address")
.help("Set the address of the led strip.") .help("Set the address of the led strip. hostname:port")
.required(true) .required(true)
.index(1)) .index(1))
.get_matches(); .get_matches();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment