Get rid of extra subcommand help message

The available subcommands are displayed using the option parser
in the vagrant client
This commit is contained in:
sophia 2021-04-13 15:07:00 -05:00 committed by Paul Hinze
parent b2cf6ed9bf
commit 434cc89a95
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
9 changed files with 104 additions and 94 deletions

View File

@ -40,16 +40,18 @@ module VagrantPlugins
def help def help
opts = OptionParser.new do |opts| opts = OptionParser.new do |opts|
opts.banner = "Usage: vagrant autocomplete <subcommand>" opts.banner = "Usage: vagrant autocomplete <subcommand>"
opts.separator "" if !Vagrant.server_mode?
opts.separator "Available subcommands:" opts.separator ""
opts.separator "Available subcommands:"
# 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.
keys = [] keys = []
keys = @subcommands.keys.map(&:to_s) keys = @subcommands.keys.map(&:to_s)
keys.sort.each do |key| keys.sort.each do |key|
opts.separator " #{key}" opts.separator " #{key}"
end
end end
opts.separator "" opts.separator ""

View File

@ -70,18 +70,19 @@ module VagrantPlugins
def help def help
opts = OptionParser.new do |opts| opts = OptionParser.new do |opts|
opts.banner = "Usage: vagrant box <subcommand> [<args>]" opts.banner = "Usage: vagrant box <subcommand> [<args>]"
opts.separator "" if !Vagrant.server_mode?
opts.separator "Available subcommands:" opts.separator ""
opts.separator "Available subcommands:"
# 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.
keys = [] keys = []
@subcommands.each { |key, value| keys << key.to_s } @subcommands.each { |key, value| keys << key.to_s }
keys.sort.each do |key| keys.sort.each do |key|
opts.separator " #{key}" opts.separator " #{key}"
end
end end
opts.separator "" opts.separator ""
opts.separator "For help on any individual subcommand run `vagrant box <subcommand> -h`" opts.separator "For help on any individual subcommand run `vagrant box <subcommand> -h`"
end end

View File

@ -48,18 +48,19 @@ module VagrantPlugins
opts.banner = "Usage: vagrant cloud auth <subcommand> [<args>]" opts.banner = "Usage: vagrant cloud auth <subcommand> [<args>]"
opts.separator "" opts.separator ""
opts.separator "Authorization with Vagrant Cloud" opts.separator "Authorization with Vagrant Cloud"
opts.separator "" if !Vagrant.server_mode?
opts.separator "Available subcommands:" opts.separator ""
opts.separator "Available subcommands:"
# 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.
keys = [] keys = []
@subcommands.each { |key, value| keys << key.to_s } @subcommands.each { |key, value| keys << key.to_s }
keys.sort.each do |key| keys.sort.each do |key|
opts.separator " #{key}" opts.separator " #{key}"
end
end end
opts.separator "" opts.separator ""
opts.separator "For help on any individual subcommand run `vagrant cloud auth <subcommand> -h`" opts.separator "For help on any individual subcommand run `vagrant cloud auth <subcommand> -h`"
end end

View File

@ -52,18 +52,19 @@ module VagrantPlugins
opts.banner = "Usage: vagrant cloud box <subcommand> [<args>]" opts.banner = "Usage: vagrant cloud box <subcommand> [<args>]"
opts.separator "" opts.separator ""
opts.separator "Commands to manage boxes on Vagrant Cloud" opts.separator "Commands to manage boxes on Vagrant Cloud"
opts.separator "" if !Vagrant.server_mode?
opts.separator "Available subcommands:" opts.separator ""
opts.separator "Available subcommands:"
# 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.
keys = [] keys = []
@subcommands.each { |key, value| keys << key.to_s } @subcommands.each { |key, value| keys << key.to_s }
keys.sort.each do |key| keys.sort.each do |key|
opts.separator " #{key}" opts.separator " #{key}"
end
end end
opts.separator "" opts.separator ""
opts.separator "For help on any individual subcommand run `vagrant cloud box <subcommand> -h`" opts.separator "For help on any individual subcommand run `vagrant cloud box <subcommand> -h`"
end end

View File

@ -52,18 +52,19 @@ module VagrantPlugins
opts.banner = "Usage: vagrant cloud provider <subcommand> [<args>]" opts.banner = "Usage: vagrant cloud provider <subcommand> [<args>]"
opts.separator "" opts.separator ""
opts.separator "For various provider actions with Vagrant Cloud" opts.separator "For various provider actions with Vagrant Cloud"
opts.separator "" if !Vagrant.server_mode?
opts.separator "Available subcommands:" opts.separator ""
opts.separator "Available subcommands:"
# 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.
keys = [] keys = []
@subcommands.each { |key, value| keys << key.to_s } @subcommands.each { |key, value| keys << key.to_s }
keys.sort.each do |key| keys.sort.each do |key|
opts.separator " #{key}" opts.separator " #{key}"
end
end end
opts.separator "" opts.separator ""
opts.separator "For help on any individual subcommand run `vagrant cloud provider <subcommand> -h`" opts.separator "For help on any individual subcommand run `vagrant cloud provider <subcommand> -h`"
end end

View File

@ -80,18 +80,19 @@ module VagrantPlugins
opts.separator "" opts.separator ""
opts.separator "The cloud command can be used for taking actions against" opts.separator "The cloud command can be used for taking actions against"
opts.separator "Vagrant Cloud like searching or uploading a Vagrant Box" opts.separator "Vagrant Cloud like searching or uploading a Vagrant Box"
opts.separator "" if !Vagrant.server_mode?
opts.separator "Available subcommands:" opts.separator ""
opts.separator "Available subcommands:"
# 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.
keys = [] keys = []
@subcommands.each { |key, value| keys << key.to_s } @subcommands.each { |key, value| keys << key.to_s }
keys.sort.each do |key| keys.sort.each do |key|
opts.separator " #{key.ljust(15)} #{@subcommand_helptext[key.to_sym]}" opts.separator " #{key.ljust(15)} #{@subcommand_helptext[key.to_sym]}"
end
end end
opts.separator "" opts.separator ""
opts.separator "For help on any individual subcommand run `vagrant cloud <subcommand> -h`" opts.separator "For help on any individual subcommand run `vagrant cloud <subcommand> -h`"
end end

View File

@ -56,18 +56,19 @@ module VagrantPlugins
opts.banner = "Usage: vagrant cloud version <subcommand> [<args>]" opts.banner = "Usage: vagrant cloud version <subcommand> [<args>]"
opts.separator "" opts.separator ""
opts.separator "For taking various actions against a Vagrant box's version attribute on Vagrant Cloud" opts.separator "For taking various actions against a Vagrant box's version attribute on Vagrant Cloud"
opts.separator "" if !Vagrant.server_mode?
opts.separator "Available subcommands:" opts.separator ""
opts.separator "Available subcommands:"
# 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.
keys = [] keys = []
@subcommands.each { |key, value| keys << key.to_s } @subcommands.each { |key, value| keys << key.to_s }
keys.sort.each do |key| keys.sort.each do |key|
opts.separator " #{key}" opts.separator " #{key}"
end
end end
opts.separator "" opts.separator ""
opts.separator "For help on any individual subcommand run `vagrant cloud version <subcommand> -h`" opts.separator "For help on any individual subcommand run `vagrant cloud version <subcommand> -h`"
end end

View File

@ -70,18 +70,19 @@ module VagrantPlugins
def help def help
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant plugin <command> [<args>]" o.banner = "Usage: vagrant plugin <command> [<args>]"
o.separator "" if !Vagrant.server_mode?
o.separator "Available subcommands:" o.separator ""
o.separator "Available subcommands:"
# 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.
keys = [] keys = []
@subcommands.each { |key, value| keys << key.to_s } @subcommands.each { |key, value| keys << key.to_s }
keys.sort.each do |key| keys.sort.each do |key|
o.separator " #{key}" o.separator " #{key}"
end
end end
o.separator "" o.separator ""
o.separator "For help on any individual command run `vagrant plugin COMMAND -h`" o.separator "For help on any individual command run `vagrant plugin COMMAND -h`"
end end

View File

@ -69,18 +69,19 @@ module VagrantPlugins
def help def help
opts = OptionParser.new do |opts| opts = OptionParser.new do |opts|
opts.banner = "Usage: vagrant snapshot <subcommand> [<args>]" opts.banner = "Usage: vagrant snapshot <subcommand> [<args>]"
opts.separator "" if !Vagrant.server_mode?
opts.separator "Available subcommands:" opts.separator ""
opts.separator "Available subcommands:"
# 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.
keys = [] keys = []
@subcommands.each { |key, value| keys << key.to_s } @subcommands.each { |key, value| keys << key.to_s }
keys.sort.each do |key| keys.sort.each do |key|
opts.separator " #{key}" opts.separator " #{key}"
end
end end
opts.separator "" opts.separator ""
opts.separator "For help on any individual subcommand run `vagrant snapshot <subcommand> -h`" opts.separator "For help on any individual subcommand run `vagrant snapshot <subcommand> -h`"
end end