Skip to content

Commit

Permalink
Since I18n isn't automatic for UI class, get rid of _ prefix on options
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Sep 22, 2010
1 parent d003cc4 commit b909add
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bin/vagrant
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ begin
# Kick start the CLI
Vagrant::CLI.start(ARGV, :env => env)
rescue Vagrant::Errors::VagrantError => e
opts = { :_prefix => false }
opts = { :prefix => false }
env.ui.error e.message, opts if e.message
env.ui.error e.backtrace.join("\n"), opts if ENV["VAGRANT_DEBUG"]
exit e.status_code if e.respond_to?(:status_code)
Expand Down
4 changes: 2 additions & 2 deletions lib/vagrant/command/box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def repackage(name)
desc "list", "Lists all installed boxes"
def list
boxes = env.boxes.sort
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) }
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) }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/command/ssh_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def execute
:ssh_user => vm.env.config.ssh.username,
:ssh_port => vm.ssh.port,
:private_key_path => vm.env.config.ssh.private_key_path
}), :_prefix => false)
}), :prefix => false)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/command/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def route
env.ui.info(I18n.t("vagrant.commands.status.output",
:states => results.join("\n"),
:message => I18n.t("vagrant.commands.status.#{state}")),
:_prefix => false)
:prefix => false)
end
end
end
Expand Down
14 changes: 7 additions & 7 deletions lib/vagrant/command/upgrade_to_060.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ class UpgradeTo060Command < Base
register "upgrade_to_060", "Upgrade pre-0.6.0 environment to 0.6.0", :hide => true

def execute
@env.ui.warn I18n.t("vagrant.commands.upgrade_to_060.info"), :_prefix => false
@env.ui.warn "", :_prefix => false
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.warn I18n.t("vagrant.commands.upgrade_to_060.info"), :prefix => false
@env.ui.warn "", :prefix => false
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
return
end

local_data = @env.local_data
if !local_data.empty?
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
end

# 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}")

# Gather the previously set virtual machines into a single
Expand All @@ -38,7 +38,7 @@ def execute
local_data.commit
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
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/command/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class VersionCommand < Base
def version
env.ui.info(I18n.t("vagrant.commands.version.output",
:version => Vagrant::VERSION),
:_prefix => false)
:prefix => false)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/vagrant/ui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def initialize(env, shell)
[:ask, :no?, :yes?].each do |method|
define_method(method) do |message, opts=nil|
opts ||= {}
@shell.send(method, format_message(message, opts), opts[:_color])
@shell.send(method, format_message(message, opts), opts[:color])
end
end

Expand All @@ -50,8 +50,8 @@ def report_progress(progress, total, show_parts=true)
protected

def format_message(message, opts=nil)
opts = { :_prefix => true }.merge(opts || {})
message = "[#{env.resource}] #{message}" if opts[:_prefix]
opts = { :prefix => true }.merge(opts || {})
message = "[#{env.resource}] #{message}" if opts[:prefix]
message
end

Expand Down
2 changes: 1 addition & 1 deletion test/vagrant/ui_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ShellUITest < Test::Unit::TestCase
true
end

@instance.info("vagrant.errors.test_key", :_prefix => false)
@instance.info("vagrant.errors.test_key", :prefix => false)
end
end
end

0 comments on commit b909add

Please sign in to comment.