mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user