Turn --from into a positional argument in gaiacli tx send (#4146)

Closes: #4142
This commit is contained in:
Alessio Treglia
2019-04-18 19:48:52 +01:00
committed by GitHub
parent 1aa3df2876
commit 93e8f467fe
5 changed files with 24 additions and 23 deletions
+8 -4
View File
@@ -58,9 +58,10 @@ type CLIContext struct {
SkipConfirm bool
}
// NewCLIContext returns a new initialized CLIContext with parameters from the
// command line using Viper.
func NewCLIContext() CLIContext {
// NewCLIContextWithFrom returns a new initialized CLIContext with parameters from the
// command line using Viper. It takes a key name or address and populates the FromName and
// FromAddress field accordingly.
func NewCLIContextWithFrom(from string) CLIContext {
var rpc rpcclient.Client
nodeURI := viper.GetString(client.FlagNode)
@@ -68,7 +69,6 @@ func NewCLIContext() CLIContext {
rpc = rpcclient.NewHTTP(nodeURI, "/websocket")
}
from := viper.GetString(client.FlagFrom)
genOnly := viper.GetBool(client.FlagGenerateOnly)
fromAddress, fromName, err := GetFromFields(from, genOnly)
if err != nil {
@@ -104,6 +104,10 @@ func NewCLIContext() CLIContext {
}
}
// NewCLIContext returns a new initialized CLIContext with parameters from the
// command line using Viper.
func NewCLIContext() CLIContext { return NewCLIContextWithFrom(viper.GetString(client.FlagFrom)) }
func createVerifier() tmlite.Verifier {
trustNodeDefined := viper.IsSet(client.FlagTrustNode)
if !trustNodeDefined {