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
|
||||
|
||||
// flagPlain is whether the output should be in plain mode.
|
||||
flagPlain bool
|
||||
// flagColor is whether the output should use colors.
|
||||
flagColor bool
|
||||
|
||||
// flagRemote is whether to execute using a remote runner or use
|
||||
// a local runner.
|
||||
@ -295,7 +295,7 @@ func (c *baseCommand) Init(opts ...Option) (err error) {
|
||||
}
|
||||
|
||||
// Reset the UI to plain if that was set
|
||||
if c.flagPlain {
|
||||
if !c.flagColor {
|
||||
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 {
|
||||
set := []*component.CommandFlag{
|
||||
{
|
||||
LongName: "plain",
|
||||
Description: "Plain output: no colors, no animation",
|
||||
DefaultValue: "false",
|
||||
LongName: "color",
|
||||
Description: "Can be used to disable colored output",
|
||||
DefaultValue: "true",
|
||||
Type: component.FlagBool,
|
||||
},
|
||||
{
|
||||
|
||||
@ -216,7 +216,7 @@ module VagrantPlugins
|
||||
|
||||
# Now we need a customized class to get the new behavior
|
||||
# that we want
|
||||
optparse_klass = Class.new(VagrantPlugins.const_get(:VagrantOriginalOptionParser)) do
|
||||
optparse_klass = Class.new(::OptionParser) do
|
||||
def initialize(*args, &block)
|
||||
super(*args, &block)
|
||||
Thread.current.thread_variable_set(:command_options, self)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user