Since I18n isn't automatic for UI class, get rid of _ prefix on options

This commit is contained in:
Mitchell Hashimoto 2010-09-21 18:14:18 -06:00
parent d003cc4f32
commit b909adde1c
8 changed files with 17 additions and 17 deletions

View File

@ -14,7 +14,7 @@ begin
# Kick start the CLI # Kick start the CLI
Vagrant::CLI.start(ARGV, :env => env) Vagrant::CLI.start(ARGV, :env => env)
rescue Vagrant::Errors::VagrantError => e rescue Vagrant::Errors::VagrantError => e
opts = { :_prefix => false } opts = { :prefix => false }
env.ui.error e.message, opts if e.message env.ui.error e.message, opts if e.message
env.ui.error e.backtrace.join("\n"), opts if ENV["VAGRANT_DEBUG"] env.ui.error e.backtrace.join("\n"), opts if ENV["VAGRANT_DEBUG"]
exit e.status_code if e.respond_to?(:status_code) exit e.status_code if e.respond_to?(:status_code)

View File

@ -25,8 +25,8 @@ module Vagrant
desc "list", "Lists all installed boxes" desc "list", "Lists all installed boxes"
def list def list
boxes = env.boxes.sort boxes = env.boxes.sort
return env.ui.warn(I18n.t("vagrant.commands.box.no_installed_boxes"), :_prefix => false) if boxes.empty? return env.ui.warn(I18n.t("vagrant.commands.box.no_installed_boxes"), :prefix => false) if boxes.empty?
boxes.each { |b| env.ui.info(b.name, :_prefix => false) } boxes.each { |b| env.ui.info(b.name, :prefix => false) }
end end
end end
end end

View File

@ -14,7 +14,7 @@ module Vagrant
:ssh_user => vm.env.config.ssh.username, :ssh_user => vm.env.config.ssh.username,
:ssh_port => vm.ssh.port, :ssh_port => vm.ssh.port,
:private_key_path => vm.env.config.ssh.private_key_path :private_key_path => vm.env.config.ssh.private_key_path
}), :_prefix => false) }), :prefix => false)
end end
end end
end end

View File

@ -16,7 +16,7 @@ module Vagrant
env.ui.info(I18n.t("vagrant.commands.status.output", env.ui.info(I18n.t("vagrant.commands.status.output",
:states => results.join("\n"), :states => results.join("\n"),
:message => I18n.t("vagrant.commands.status.#{state}")), :message => I18n.t("vagrant.commands.status.#{state}")),
:_prefix => false) :prefix => false)
end end
end end
end end

View File

@ -6,22 +6,22 @@ module Vagrant
register "upgrade_to_060", "Upgrade pre-0.6.0 environment to 0.6.0", :hide => true register "upgrade_to_060", "Upgrade pre-0.6.0 environment to 0.6.0", :hide => true
def execute def execute
@env.ui.warn I18n.t("vagrant.commands.upgrade_to_060.info"), :_prefix => false @env.ui.warn I18n.t("vagrant.commands.upgrade_to_060.info"), :prefix => false
@env.ui.warn "", :_prefix => false @env.ui.warn "", :prefix => false
if !@env.ui.yes? I18n.t("vagrant.commands.upgrade_to_060.ask"), :_prefix => false, :_color => :yellow if !@env.ui.yes? I18n.t("vagrant.commands.upgrade_to_060.ask"), :prefix => false, :color => :yellow
@env.ui.info I18n.t("vagrant.commands.upgrade_to_060.quit"), :_prefix => false @env.ui.info I18n.t("vagrant.commands.upgrade_to_060.quit"), :prefix => false
return return
end end
local_data = @env.local_data local_data = @env.local_data
if !local_data.empty? if !local_data.empty?
if local_data[:active] if local_data[:active]
@env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.already_done"), :_prefix => false @env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.already_done"), :prefix => false
return return
end end
# Backup the previous file # Backup the previous file
@env.ui.info I18n.t("vagrant.commands.upgrade_to_060.backing_up"), :_prefix => false @env.ui.info I18n.t("vagrant.commands.upgrade_to_060.backing_up"), :prefix => false
FileUtils.cp(local_data.file_path, "#{local_data.file_path}.bak-#{Time.now.to_i}") FileUtils.cp(local_data.file_path, "#{local_data.file_path}.bak-#{Time.now.to_i}")
# Gather the previously set virtual machines into a single # Gather the previously set virtual machines into a single
@ -38,7 +38,7 @@ module Vagrant
local_data.commit local_data.commit
end end
@env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.complete"), :_prefix => false @env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.complete"), :prefix => false
end end
end end
end end

View File

@ -6,7 +6,7 @@ module Vagrant
def version def version
env.ui.info(I18n.t("vagrant.commands.version.output", env.ui.info(I18n.t("vagrant.commands.version.output",
:version => Vagrant::VERSION), :version => Vagrant::VERSION),
:_prefix => false) :prefix => false)
end end
end end
end end

View File

@ -34,7 +34,7 @@ module Vagrant
[:ask, :no?, :yes?].each do |method| [:ask, :no?, :yes?].each do |method|
define_method(method) do |message, opts=nil| define_method(method) do |message, opts=nil|
opts ||= {} opts ||= {}
@shell.send(method, format_message(message, opts), opts[:_color]) @shell.send(method, format_message(message, opts), opts[:color])
end end
end end
@ -50,8 +50,8 @@ module Vagrant
protected protected
def format_message(message, opts=nil) def format_message(message, opts=nil)
opts = { :_prefix => true }.merge(opts || {}) opts = { :prefix => true }.merge(opts || {})
message = "[#{env.resource}] #{message}" if opts[:_prefix] message = "[#{env.resource}] #{message}" if opts[:prefix]
message message
end end

View File

@ -23,7 +23,7 @@ class ShellUITest < Test::Unit::TestCase
true true
end end
@instance.info("vagrant.errors.test_key", :_prefix => false) @instance.info("vagrant.errors.test_key", :prefix => false)
end end
end end
end end