From 4652779a3d1b35f09ac84bb20d624da3e56940c4 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Fri, 28 Jul 2017 15:13:31 -0400 Subject: [PATCH] Fix up flag handling --- client/commands/proofs/get.go | 2 +- client/commands/proofs/root.go | 7 +++---- tests/cli/basictx.sh | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/client/commands/proofs/get.go b/client/commands/proofs/get.go index e392e96db7..c3e510b3b8 100644 --- a/client/commands/proofs/get.go +++ b/client/commands/proofs/get.go @@ -46,7 +46,7 @@ func GetProof(node client.Client, prover lc.Prover, key []byte, height int) (pro } // short-circuit with no proofs - if viper.GetBool(FlagTrustNode) { + if viper.GetBool(commands.FlagTrustNode) { return proof, err } diff --git a/client/commands/proofs/root.go b/client/commands/proofs/root.go index 7a136025ad..9a1f50d272 100644 --- a/client/commands/proofs/root.go +++ b/client/commands/proofs/root.go @@ -7,8 +7,7 @@ import ( // nolint const ( - FlagHeight = "height" - FlagTrustNode = "trust-node" + FlagHeight = "height" ) // RootCmd represents the base command when called without any subcommands @@ -24,7 +23,7 @@ data to other peers as needed. } func init() { - RootCmd.Flags().Int(FlagHeight, 0, "Height to query (skip to use latest block)") - RootCmd.Flags().Bool(commands.FlagTrustNode, false, + RootCmd.PersistentFlags().Int(FlagHeight, 0, "Height to query (skip to use latest block)") + RootCmd.PersistentFlags().Bool(commands.FlagTrustNode, false, "DANGEROUS: blindly trust all results from the server") } diff --git a/tests/cli/basictx.sh b/tests/cli/basictx.sh index 101bb04aaf..1831f76f7d 100755 --- a/tests/cli/basictx.sh +++ b/tests/cli/basictx.sh @@ -86,13 +86,13 @@ test02SendTxWithFee() { # make sure this works without trust also OLD_BC_HOME=$BC_HOME export BC_HOME=/foo - export BCTRUST_NODE=1 - export BCNODE=localhost:46657 + export BC_TRUST_NODE=1 + export BC_NODE=localhost:46657 checkSendFeeTx $HASH $TX_HEIGHT $SENDER "90" "10" checkAccount $SENDER "9007199254739900" checkAccount $RECV "1082" - unset BCTRUST_NODE - unset BCNODE + unset BC_TRUST_NODE + unset BC_NODE export BC_HOME=$OLD_BC_HOME }