Use :ui_class opt to set ui class
This commit is contained in:
parent
d230272062
commit
0296e59baf
13
bin/vagrant
13
bin/vagrant
@ -78,12 +78,6 @@ if argv.include?("--debug-timestamp")
|
||||
ENV["VAGRANT_LOG_TIMESTAMP"] = "1"
|
||||
end
|
||||
|
||||
# Setting to enable/disable showing progress bars
|
||||
if argv.include?("--quiet-progress")
|
||||
argv.delete("--quiet-progress")
|
||||
ENV["VAGRANT_QUIET_PROGRESS"] = "1"
|
||||
end
|
||||
|
||||
# Stdout/stderr should not buffer output
|
||||
$stdout.sync = true
|
||||
$stderr.sync = true
|
||||
@ -114,6 +108,7 @@ begin
|
||||
o.on("--debug", "Enable debug output")
|
||||
o.on("--timestamp", "Enable timestamps on log output")
|
||||
o.on("--debug-timestamp", "Enable debug output with timestamps")
|
||||
o.on("--no-tty", "Enable non-interactive output")
|
||||
})
|
||||
|
||||
# Create a logger right away
|
||||
@ -152,6 +147,12 @@ begin
|
||||
opts[:ui_class] = Vagrant::UI::MachineReadable
|
||||
end
|
||||
|
||||
# Setting to enable/disable showing progress bars
|
||||
if argv.include?("--no-tty")
|
||||
argv.delete("--no-tty")
|
||||
opts[:ui_class] = Vagrant::UI::NonInteractive
|
||||
end
|
||||
|
||||
# Default to colored output
|
||||
opts[:ui_class] ||= Vagrant::UI::Colored
|
||||
|
||||
|
||||
@ -31,14 +31,8 @@ module Vagrant
|
||||
attr_accessor :stderr
|
||||
|
||||
def initialize
|
||||
if ENV["VAGRANT_QUIET_PROGRESS"]
|
||||
show_progress = false
|
||||
else
|
||||
show_progress = true
|
||||
end
|
||||
|
||||
@logger = Log4r::Logger.new("vagrant::ui::interface")
|
||||
@opts = { :show_progress => show_progress }
|
||||
@opts = {}
|
||||
@stdin = $stdin
|
||||
@stdout = $stdout
|
||||
@stderr = $stderr
|
||||
|
||||
@ -92,11 +92,12 @@ describe "vagrant bin" do
|
||||
end
|
||||
end
|
||||
|
||||
describe "--quiet-progress" do
|
||||
let(:argv) { ["--quiet-progress"] }
|
||||
describe "--no-tty" do
|
||||
let(:argv) { ["--no-tty"] }
|
||||
|
||||
it "should enable less verbose progress output" do
|
||||
expect(ENV).to receive(:[]=).with("VAGRANT_QUIET_PROGRESS", "1")
|
||||
expect(Vagrant::Environment).to receive(:new).
|
||||
with(hash_including(ui_class: Vagrant::UI::NonInteractive))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user