Work around a few global flag collisions for ssh command
* `vagrant ssh` has a --no-tty flag colliding with the one defined in `bin/vagrant` - in fact none of the flags in `bin/vagrant` are processed in `serve` mode, so remove the code that captures them from the CommandInfo OptionParser dance * `vagrant ssh` has a `--plain` flag colliding with the one defined in `internal/cli/base.go` - this flag was inherited from Waypoint, so we can just rename it to line up with the (inversely defined) `--color` flag used in legacy vagrant
This commit is contained in:
parent
57babc2f79
commit
7f56168959
@ -72,8 +72,8 @@ type baseCommand struct {
|
|||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Internal fields that should not be accessed directly
|
// Internal fields that should not be accessed directly
|
||||||
|
|
||||||
// flagPlain is whether the output should be in plain mode.
|
// flagColor is whether the output should use colors.
|
||||||
flagPlain bool
|
flagColor bool
|
||||||
|
|
||||||
// flagRemote is whether to execute using a remote runner or use
|
// flagRemote is whether to execute using a remote runner or use
|
||||||
// a local runner.
|
// a local runner.
|
||||||
@ -295,7 +295,7 @@ func (c *baseCommand) Init(opts ...Option) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset the UI to plain if that was set
|
// Reset the UI to plain if that was set
|
||||||
if c.flagPlain {
|
if !c.flagColor {
|
||||||
c.ui = terminal.NonInteractiveUI(c.Ctx)
|
c.ui = terminal.NonInteractiveUI(c.Ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,9 +378,9 @@ func (c *baseCommand) logError(log hclog.Logger, prefix string, err error) {
|
|||||||
func (c *baseCommand) flagSet(bit flagSetBit, f func([]*component.CommandFlag) []*component.CommandFlag) component.CommandFlags {
|
func (c *baseCommand) flagSet(bit flagSetBit, f func([]*component.CommandFlag) []*component.CommandFlag) component.CommandFlags {
|
||||||
set := []*component.CommandFlag{
|
set := []*component.CommandFlag{
|
||||||
{
|
{
|
||||||
LongName: "plain",
|
LongName: "color",
|
||||||
Description: "Plain output: no colors, no animation",
|
Description: "Can be used to disable colored output",
|
||||||
DefaultValue: "false",
|
DefaultValue: "true",
|
||||||
Type: component.FlagBool,
|
Type: component.FlagBool,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -216,7 +216,7 @@ module VagrantPlugins
|
|||||||
|
|
||||||
# Now we need a customized class to get the new behavior
|
# Now we need a customized class to get the new behavior
|
||||||
# that we want
|
# that we want
|
||||||
optparse_klass = Class.new(VagrantPlugins.const_get(:VagrantOriginalOptionParser)) do
|
optparse_klass = Class.new(::OptionParser) do
|
||||||
def initialize(*args, &block)
|
def initialize(*args, &block)
|
||||||
super(*args, &block)
|
super(*args, &block)
|
||||||
Thread.current.thread_variable_set(:command_options, self)
|
Thread.current.thread_variable_set(:command_options, self)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user