clean up usage

This commit is contained in:
gnawhleinad 2014-02-08 00:20:50 -08:00
parent 8c85e57db1
commit fbcac2978e
16 changed files with 63 additions and 45 deletions

View File

@ -55,12 +55,12 @@ module Vagrant
# an optionparser above because I don't think the performance hits # an optionparser above because I don't think the performance hits
# of creating a whole object are worth checking only a couple flags. # of creating a whole object are worth checking only a couple flags.
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant [-v] [-h] command [<args>]" o.banner = "Usage: vagrant [options] <command> [<args>]"
o.separator "" o.separator ""
o.on("-v", "--version", "Print the version and exit.") o.on("-v", "--version", "Print the version and exit.")
o.on("-h", "--help", "Print this help.") o.on("-h", "--help", "Print this help.")
o.separator "" o.separator ""
o.separator "Common subcommands:" o.separator "Common commands:"
# Add the available subcommands as separators in order to print them # Add the available subcommands as separators in order to print them
# out as well. # out as well.

View File

@ -8,14 +8,16 @@ module VagrantPlugins
options = {} options = {}
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant box add <url> [-h]" o.banner = "Usage: vagrant box add [options] <url>"
o.separator ""
o.separator "Options:"
o.separator "" o.separator ""
o.on("-c", "--clean", "Clean any temporary download files") do |c| o.on("-c", "--clean", "Clean any temporary download files") do |c|
options[:clean] = c options[:clean] = c
end end
o.on("-f", "--force", "Overwrite an existing box if it exists.") do |f| o.on("-f", "--force", "Overwrite an existing box if it exists") do |f|
options[:force] = f options[:force] = f
end end
@ -23,20 +25,20 @@ module VagrantPlugins
options[:insecure] = i options[:insecure] = i
end end
o.on("--cacert certfile", String, "CA certificate for SSL download") do |c| o.on("--cacert FILE", String, "CA certificate for SSL download") do |c|
options[:ca_cert] = c options[:ca_cert] = c
end end
o.on("--cert certfile", String, o.on("--cert FILE", String,
"A client SSL cert, if needed") do |c| "A client SSL cert, if needed") do |c|
options[:client_cert] = c options[:client_cert] = c
end end
o.on("--provider VALUE", String, "Provider the box should satisfy") do |p| o.on("--provider PROVIDER", String, "Provider the box should satisfy") do |p|
options[:provider] = p options[:provider] = p
end end
o.on("--box-version VALUE", String, "Constrain version of the added box") do |v| o.on("--box-version VERSION", String, "Constrain version of the added box") do |v|
options[:version] = v options[:version] = v
end end
@ -45,15 +47,15 @@ module VagrantPlugins
o.separator "and not using a Vagrant server or a box structured like 'user/box':" o.separator "and not using a Vagrant server or a box structured like 'user/box':"
o.separator "" o.separator ""
o.on("--checksum VALUE", String, "Checksum for the box") do |c| o.on("--checksum CHECKSUM", String, "Checksum for the box") do |c|
options[:checksum] = c options[:checksum] = c
end end
o.on("--checksum-type VALUE", String, "Checksum type (md5, sha1, sha256)") do |c| o.on("--checksum-type TYPE", String, "Checksum type (md5, sha1, sha256)") do |c|
options[:checksum_type] = c.to_sym options[:checksum_type] = c.to_sym
end end
o.on("--name VALUE", String, "Name of the box") do |n| o.on("--name BOX", String, "Name of the box") do |n|
options[:name] = n options[:name] = n
end end
end end

View File

@ -8,10 +8,12 @@ module VagrantPlugins
options = {} options = {}
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant box list" o.banner = "Usage: vagrant box list [options]"
o.separator ""
o.separator "Options:"
o.separator "" o.separator ""
o.on("-i", "--box-info", "Displays additional information about the boxes.") do |i| o.on("-i", "--box-info", "Displays additional information about the boxes") do |i|
options[:info] = i options[:info] = i
end end
end end

View File

@ -17,7 +17,7 @@ module VagrantPlugins
o.separator "Options:" o.separator "Options:"
o.separator "" o.separator ""
o.on("--global", "Check all boxes installed.") do |g| o.on("--global", "Check all boxes installed") do |g|
options[:global] = g options[:global] = g
end end
end end

View File

@ -9,14 +9,16 @@ module VagrantPlugins
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant box remove <name>" o.banner = "Usage: vagrant box remove <name>"
o.separator "" o.separator ""
o.separator "Options:"
o.separator ""
o.on("--provider VALUE", String, o.on("--provider PROVIDER", String,
"The specific provider type for the box to remove.") do |p| "The specific provider type for the box to remove") do |p|
options[:provider] = p options[:provider] = p
end end
o.on("--box-version VALUE", String, o.on("--box-version VERSION", String,
"The specific version of the box to remove.") do |v| "The specific version of the box to remove") do |v|
options[:version] = v options[:version] = v
end end
end end

View File

@ -64,7 +64,7 @@ module VagrantPlugins
# Prints the help out for this command # Prints the help out for this command
def help def help
opts = OptionParser.new do |opts| opts = OptionParser.new do |opts|
opts.banner = "Usage: vagrant box <command> [<args>]" opts.banner = "Usage: vagrant box <subcommand> [<args>]"
opts.separator "" opts.separator ""
opts.separator "Available subcommands:" opts.separator "Available subcommands:"
@ -78,7 +78,7 @@ module VagrantPlugins
end end
opts.separator "" opts.separator ""
opts.separator "For help on any individual command run `vagrant box COMMAND -h`" opts.separator "For help on any individual subcommand run `vagrant box <subcommand> -h`"
end end
@env.ui.info(opts.help, :prefix => false) @env.ui.info(opts.help, :prefix => false)

View File

@ -20,11 +20,11 @@ module VagrantPlugins
o.separator "Options:" o.separator "Options:"
o.separator "" o.separator ""
o.on("--box VALUE", String, "Update a specific box") do |b| o.on("--box BOX", String, "Update a specific box") do |b|
options[:box] = b options[:box] = b
end end
o.on("--provider VALUE", String, "Update box with specific provider.") do |p| o.on("--provider PROVIDER", String, "Update box with specific provider") do |p|
options[:provider] = p.to_sym options[:provider] = p.to_sym
end end
end end

View File

@ -10,7 +10,9 @@ module VagrantPlugins
options[:force] = false options[:force] = false
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant destroy [vm-name]" o.banner = "Usage: vagrant destroy [options] [name]"
o.separator ""
o.separator "Options:"
o.separator "" o.separator ""
o.on("-f", "--force", "Destroy without confirmation.") do |f| o.on("-f", "--force", "Destroy without confirmation.") do |f|

View File

@ -12,7 +12,9 @@ module VagrantPlugins
options[:force] = false options[:force] = false
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant halt [vm-name] [--force] [-h]" o.banner = "Usage: vagrant halt [options] [name]"
o.separator ""
o.separator "Options:"
o.separator "" o.separator ""
o.on("-f", "--force", "Force shut down (equivalent of pulling power)") do |f| o.on("-f", "--force", "Force shut down (equivalent of pulling power)") do |f|

View File

@ -13,10 +13,13 @@ module VagrantPlugins
options = { output: "Vagrantfile" } options = { output: "Vagrantfile" }
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant init [box-name] [box-url]" o.banner = "Usage: vagrant init [name] [url]"
o.separator ""
o.separator "Options:"
o.separator ""
o.on("--output FILENAME", String, o.on("--output FILE", String,
"Output path for the box. '-' for stdout.") do |output| "Output path for the box. '-' for stdout") do |output|
options[:output] = output options[:output] = output
end end
end end

View File

@ -11,9 +11,9 @@ module VagrantPlugins
options = {} options = {}
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant package [vm-name] [--base name] [--output name.box]" o.banner = "Usage: vagrant package [options] [name]"
o.separator " [--include one,two,three] [--vagrantfile file]" o.separator ""
o.separator "Options:"
o.separator "" o.separator ""
o.on("--base NAME", "Name of a VM in virtualbox to package as a base box") do |b| o.on("--base NAME", "Name of a VM in virtualbox to package as a base box") do |b|
@ -24,11 +24,11 @@ module VagrantPlugins
options[:output] = output options[:output] = output
end end
o.on("--include x,y,z", Array, "Additional files to package with the box.") do |i| o.on("--include FILE...", Array, "Additional files to package with the box") do |i|
options[:include] = i options[:include] = i
end end
o.on("--vagrantfile file", "Vagrantfile to package with the box.") do |v| o.on("--vagrantfile FILE", "Vagrantfile to package with the box") do |v|
options[:vagrantfile] = v options[:vagrantfile] = v
end end
end end

View File

@ -11,15 +11,16 @@ module VagrantPlugins
options = {} options = {}
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant ssh [vm-name] [-c command] [-- extra ssh args]" o.banner = "Usage: vagrant ssh [options] [name] [-- extra ssh args]"
o.separator ""
o.separator "Options:"
o.separator "" o.separator ""
o.on("-c", "--command COMMAND", "Execute an SSH command directly.") do |c| o.on("-c", "--command COMMAND", "Execute an SSH command directly") do |c|
options[:command] = c options[:command] = c
end end
o.on("-p", "--plain", "Plain mode, leaves authentication up to user.") do |p| o.on("-p", "--plain", "Plain mode, leaves authentication up to user") do |p|
options[:plain_mode] = p options[:plain_mode] = p
end end
end end

View File

@ -15,10 +15,12 @@ module VagrantPlugins
options = {} options = {}
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant ssh-config [vm-name] [--host name]" o.banner = "Usage: vagrant ssh-config [options] [name]"
o.separator ""
o.separator "Options:"
o.separator "" o.separator ""
o.on("--host COMMAND", "Name the host for the config..") do |h| o.on("--host NAME", "Name the host for the config") do |h|
options[:host] = h options[:host] = h
end end
end end

View File

@ -9,7 +9,7 @@ module VagrantPlugins
def execute def execute
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant status [machine-name]" o.banner = "Usage: vagrant status [name]"
end end
# Parse the options # Parse the options

View File

@ -9,7 +9,7 @@ module VagrantPlugins
def execute def execute
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant suspend [vm-name]" o.banner = "Usage: vagrant suspend [name]"
end end
# Parse the options # Parse the options

View File

@ -20,23 +20,25 @@ module VagrantPlugins
options[:provision_ignore_sentinel] = false options[:provision_ignore_sentinel] = false
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant up [vm-name] [options] [-h]" o.banner = "Usage: vagrant up [options] [name]"
o.separator ""
o.separator "Options:"
o.separator "" o.separator ""
build_start_options(o, options) build_start_options(o, options)
o.on("--[no-]destroy-on-error", o.on("--[no-]destroy-on-error",
"Destroy machine if any fatal error happens (default to true).") do |destroy| "Destroy machine if any fatal error happens (default to true)") do |destroy|
options[:destroy_on_error] = destroy options[:destroy_on_error] = destroy
end end
o.on("--[no-]parallel", o.on("--[no-]parallel",
"Enable or disable parallelism if provider supports it.") do |parallel| "Enable or disable parallelism if provider supports it") do |parallel|
options[:parallel] = parallel options[:parallel] = parallel
end end
o.on("--provider provider", String, o.on("--provider PROVIDER", String,
"Back the machine with a specific provider.") do |provider| "Back the machine with a specific provider") do |provider|
options[:provider] = provider options[:provider] = provider
end end
end end