Add machine readable bool endpoint to terminal ui

This commit is contained in:
sophia 2022-05-31 15:47:47 -05:00
parent 4ffe33461c
commit 194882214a
4 changed files with 18 additions and 1 deletions

View File

@ -42,6 +42,10 @@ func (u *runnerUI) Interactive() bool {
return false
}
func (u *runnerUI) MachineReadable() bool {
return false
}
func (u *runnerUI) ClearLine() {
// NO-OP - noninteractive
}

View File

@ -52,6 +52,15 @@ func (u *multiUI) Interactive() bool {
return false
}
func (u *multiUI) MachineReadable() bool {
for _, u := range u.UIs {
if u.MachineReadable() {
return true
}
}
return false
}
func (u *multiUI) Output(msg string, raw ...interface{}) {
for _, u := range u.UIs {
u.Output(msg, raw...)

View File

@ -44,7 +44,7 @@ module Vagrant
end
def machine(type, *data)
if client.is_interactive
if !client.is_machine_readable
@logger.info("Machine: #{type} #{data.inspect}")
return
end

View File

@ -22,6 +22,10 @@ module VagrantPlugins
client.is_interactive(Empty.new).interactive
end
def is_machine_readable
client.is_machine_readable(Empty.new).machine_readable
end
def input(prompt, **opts)
event_resp = client.events(
[