-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
package cli | ||
|
||
import ( | ||
"os" | ||
"strings" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
const ( | ||
// ManualVerboseEnvVar is the environment variable that can be set to disable | ||
// automatic verbose mode on CI servers. | ||
ManualVerboseEnvVar = "KNATIVE_HACK_SCRIPT_MANUAL_VERBOSE" | ||
) | ||
|
||
type flags struct { | ||
verbose bool | ||
} | ||
|
||
func (f *flags) withFlags(c *cobra.Command) *cobra.Command { | ||
fl := c.PersistentFlags() | ||
fl.BoolVarP(&f.verbose, "verbose", "v", false, "Print verbose output on Stderr") | ||
fl.BoolVarP(&f.verbose, "verbose", "v", isCiServer(), "Print verbose output on Stderr") | ||
return c | ||
} | ||
|
||
func isCiServer() bool { | ||
if strings.HasPrefix(strings.ToLower(os.Getenv(ManualVerboseEnvVar)), "t") { | ||
return false | ||
} | ||
return os.Getenv("CI") != "" || | ||
os.Getenv("BUILD_ID") != "" || | ||
os.Getenv("PROW_JOB_ID") != "" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.