From cdd35280e798bb2fb416c51aafe4b8a89938e85f Mon Sep 17 00:00:00 2001 From: Bojan Date: Tue, 21 Jan 2020 22:09:22 -0400 Subject: [PATCH] Allow to set host outside of config. Fixes #157 --- cmd/ghz/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/ghz/main.go b/cmd/ghz/main.go index ff62edf5..f4461255 100644 --- a/cmd/ghz/main.go +++ b/cmd/ghz/main.go @@ -176,7 +176,8 @@ var ( debug = kingpin.Flag("debug", "The path to debug log file."). PlaceHolder(" ").IsSetByUser(&isDebugSet).String() - host = kingpin.Arg("host", "Host and port to test.").String() + isHostSet = false + host = kingpin.Arg("host", "Host and port to test.").String() ) func main() { @@ -185,6 +186,8 @@ func main() { kingpin.CommandLine.VersionFlag.Short('v') kingpin.Parse() + isHostSet = *host != "" + cfgPath := strings.TrimSpace(*cPath) var cfg config @@ -578,6 +581,10 @@ func mergeConfig(dest *config, src *config) error { dest.Debug = src.Debug } + if isHostSet { + dest.Host = src.Host + } + return nil }