Prevent warnings from showing in individual commands when format is not table, in addition to the existing hiding of higher-level deprecation warnings

This commit is contained in:
Jeff Mitchell
2018-05-23 17:13:39 -04:00
parent b104ad5c90
commit 9e92a1fc10
9 changed files with 106 additions and 77 deletions

View File

@@ -217,9 +217,11 @@ func (c *OperatorGenerateRootCommand) Run(args []string) int {
// TODO: remove in 0.9.0
switch {
case c.flagGenOTP:
c.UI.Warn(wrapAtLength(
"The -gen-otp flag is deprecated. Please use the -generate-otp flag " +
"instead."))
if Format(c.UI) == "table" {
c.UI.Warn(wrapAtLength(
"WARNING! The -gen-otp flag is deprecated. Please use the -generate-otp flag " +
"instead."))
}
c.flagGenerateOTP = c.flagGenOTP
}