diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f2ccb685..b6fa414bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.9.3 (unreleased) - + - Proper error handling for not enough arguments to `box add`. ## 0.9.2 (January 20, 2012) diff --git a/lib/vagrant/command/box_add.rb b/lib/vagrant/command/box_add.rb index 9c4c029ce..15600c0d8 100644 --- a/lib/vagrant/command/box_add.rb +++ b/lib/vagrant/command/box_add.rb @@ -18,6 +18,7 @@ module Vagrant # Parse the options argv = parse_options(opts) return if !argv + raise Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 2 # If we're force adding, then be sure to destroy any existing box if it # exists. diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 5e7c1f82c..3d3ccc1ff 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -128,6 +128,11 @@ module Vagrant error_key(:failed, "vagrant.actions.box.verify") end + class CLIInvalidUsage < VagrantError + status_code(69) + error_key(:cli_invalid_usage) + end + class CLIInvalidOptions < VagrantError status_code(1) error_key(:cli_invalid_options) diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 80b176b92..65797eb36 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -30,6 +30,11 @@ en: An invalid option was specified. The help for this command is available below. + %{help} + cli_invalid_usage: |- + This command was not invoked properly. The help for this command is + available below. + %{help} config_validation: |- There was a problem with the configuration of Vagrant. The error message(s)