Skip to content

Commit

Permalink
Fix global args
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenroose committed Nov 1, 2018
1 parent b3e8528 commit 299bad6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/context.rs
Expand Up @@ -13,18 +13,21 @@ pub fn global_args<'a>() -> Vec<clap::Arg<'a, 'a>> {
.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),
]
}

Expand All @@ -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;
}

Expand Down
4 changes: 3 additions & 1 deletion src/main.rs
Expand Up @@ -53,13 +53,15 @@ fn main() {
.version("0.0.0")
.author("Steven Roose <steven@blockstream.io>")
.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())
Expand Down

0 comments on commit 299bad6

Please sign in to comment.