Rename --tty flag to --interactive

This commit is contained in:
sophia 2022-05-25 16:10:27 -05:00
parent e2bd70bb77
commit 4f63043646

View File

@ -88,8 +88,8 @@ type baseCommand struct {
// flagTarget is the machine to target. // flagTarget is the machine to target.
flagTarget string flagTarget string
// flagTTY is whether the output is interactive // flagInteractive is whether the output is interactive
flagTTY bool flagInteractive bool
// flagConnection contains manual flag-based connection info. // flagConnection contains manual flag-based connection info.
flagConnection clicontext.Config flagConnection clicontext.Config
@ -154,8 +154,8 @@ func BaseCommand(ctx context.Context, log hclog.Logger, logOutput io.Writer, opt
// Set UI // Set UI
var ui terminal.UI var ui terminal.UI
// Set non interactive if the --no-tty flag is provided // Set non interactive if the --no-interactive flag is provided
if !bc.flagTTY { if !bc.flagInteractive {
ui = terminal.NonInteractiveUI(ctx) ui = terminal.NonInteractiveUI(ctx)
} else { } else {
// If no ui related flags are set, create a new one // If no ui related flags are set, create a new one
@ -285,8 +285,8 @@ func (c *baseCommand) Init(opts ...Option) (err error) {
// Set UI // Set UI
var ui terminal.UI var ui terminal.UI
// Set non interactive if the --no-tty flag is provided // Set non interactive if the --no-interactive flag is provided
if !c.flagTTY { if !c.flagInteractive {
ui = terminal.NonInteractiveUI(c.Ctx) ui = terminal.NonInteractiveUI(c.Ctx)
} else { } else {
// If no ui related flags are set, use the base config ui // If no ui related flags are set, use the base config ui
@ -402,7 +402,7 @@ func (c *baseCommand) flagSet(bit flagSetBit, f func([]*component.CommandFlag) [
Type: component.FlagString, Type: component.FlagString,
}, },
{ {
LongName: "tty", LongName: "interactive",
Description: "Enable non-interactive output", Description: "Enable non-interactive output",
DefaultValue: "true", DefaultValue: "true",
Type: component.FlagBool, Type: component.FlagBool,
@ -491,8 +491,8 @@ func (c *baseCommand) Parse(
} }
case "remote": case "remote":
c.flagRemote = pf.DefaultValue().(bool) c.flagRemote = pf.DefaultValue().(bool)
case "tty": case "interactive":
c.flagTTY = pf.DefaultValue().(bool) c.flagInteractive = pf.DefaultValue().(bool)
} }
if !pf.Updated() { if !pf.Updated() {
continue continue
@ -507,8 +507,8 @@ func (c *baseCommand) Parse(
c.flagTarget = pf.Value().(string) c.flagTarget = pf.Value().(string)
case "remote": case "remote":
c.flagRemote = pf.Value().(bool) c.flagRemote = pf.Value().(bool)
case "tty": case "interactive":
c.flagTTY = pf.Value().(bool) c.flagInteractive = pf.Value().(bool)
} }
c.flagData[f] = pf.Value() c.flagData[f] = pf.Value()
} }