Don't set a default value for -o flag and fix ODO_LOG_LEVEL check (#3121)

* Don't set a default value for -o flag

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Change how `output` flag is looked up

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Update comment

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Properly retrieve value of ODO_LOG_LEVEL

Signed-off-by: John Collier <John.J.Collier@ibm.com>
This commit is contained in:
John Collier
2020-05-12 19:02:30 -04:00
committed by GitHub
parent fa7a2fc297
commit a3f0d4fcd7
3 changed files with 8 additions and 11 deletions

View File

@@ -3,7 +3,6 @@ package main
import (
"flag"
"os"
"strings"
"github.com/openshift/odo/pkg/log"
"github.com/openshift/odo/pkg/odo/cli"
@@ -46,15 +45,6 @@ func main() {
}
}
// Override the logging level by the value (if set) by the ODO_LOG_LEVEL env
// The "-v" flag set on command line will take precedence over ODO_LOG_LEVEL env
v := flag.CommandLine.Lookup("v").Value.String()
// if the json flag is passed and is valid, we don't turn on ODO_LOG_LEVEL
jsonFlagValue := flag.CommandLine.Lookup("o").Value.String()
if level, ok := os.LookupEnv("ODO_LOG_LEVEL"); ok && v == "0" && strings.ToLower(jsonFlagValue) != "json" {
_ = flag.CommandLine.Set("v", level)
}
// run the completion, in case that the completion was invoked
// and ran as a completion script or handled a flag that passed
// as argument, the Run method will return true,