Message ID | 20160718005531.27439-1-ruscur@russell.cc |
---|---|
State | Accepted |
Headers | show |
On 18/07/16 10:55, Russell Currey wrote: > I thought we got this by default with docopt but that's not true. There > is a helper in docopt, though, which is nice. > > Signed-off-by: Russell Currey <ruscur@russell.cc> Applied to master: 1289f4e75dde615235ea6291cb8e34316f5d3114 Thanks,
diff --git a/src/main.rs b/src/main.rs index 9bb2064..57fd5ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -245,8 +245,11 @@ fn main() { } log_builder.init().unwrap(); + let version = format!("{} version {}", + env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); + let args: Args = Docopt::new(USAGE) - .and_then(|d| d.decode()) + .and_then(|d| d.version(Some(version)).decode()) .unwrap_or_else(|e| e.exit()); let settings = settings::parse(args.arg_config_file);
I thought we got this by default with docopt but that's not true. There is a helper in docopt, though, which is nice. Signed-off-by: Russell Currey <ruscur@russell.cc> --- V2: compile time, add prefix --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)