From 299bad64eb45979559ad650dfef62b2836aac006 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Thu, 1 Nov 2018 10:17:40 +0000 Subject: [PATCH] Fix global args --- src/context.rs | 10 +++++++--- src/main.rs | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/context.rs b/src/context.rs index 57e2781..2de1afa 100644 --- a/src/context.rs +++ b/src/context.rs @@ -13,18 +13,21 @@ pub fn global_args<'a>() -> Vec> { .short("v") .multiple(true) .takes_value(false) - .help("print verbose logging output to stderr"), + .help("print verbose logging output to stderr") + .global(true), clap::Arg::with_name("proof-file") .long("proof-file") .short("f") .help("the proof-of-reserves file to use") .takes_value(true) - .default_value("reserves.proof"), + .default_value("reserves.proof") + .global(true), clap::Arg::with_name("dry-run") .short("n") .long("dry-run") .takes_value(false) - .help("perform a dry run: no changes will be made to the proof file"), + .help("perform a dry run: no changes will be made to the proof file") + .global(true), ] } @@ -50,6 +53,7 @@ impl<'a> Ctx<'a> { pub fn save_proof_file(&self, pf: common::ProofFile) { if self.dry_run() { + println!("Dry-run: not writing proof file to disk."); return; } diff --git a/src/main.rs b/src/main.rs index 3a40e2a..550dc66 100644 --- a/src/main.rs +++ b/src/main.rs @@ -53,13 +53,15 @@ fn main() { .version("0.0.0") .author("Steven Roose ") .about("Proof-of-Reserves generator and verifier") + .setting(AppSettings::GlobalVersion) + .setting(AppSettings::VersionlessSubcommands) .setting(AppSettings::SubcommandRequiredElseHelp) .setting(AppSettings::AllArgsOverrideSelf) .args(&context::global_args()) + //TODO(stevenroose) consider not having clap autosort them .subcommand(cmd::init::subcommand()) .subcommand(cmd::inspect::subcommand()) .subcommand(cmd::drop::subcommand()) - //.subcommand(cmd::add_proof::subcommand()) .subcommand(cmd::verify::subcommand()) .subcommand(cmd::fetch_utxos::subcommand()) .subcommand(cmd::add_proof::subcommand())