core: non-primary commands aren't shown in basic `vagrant -h`

This commit is contained in:
Mitchell Hashimoto 2014-01-11 09:07:38 -08:00
parent 9c0649d2f8
commit f05388349c
2 changed files with 9 additions and 5 deletions

View File

@ -60,6 +60,10 @@ module Vagrant
commands = {}
longest = 0
Vagrant.plugin("2").manager.commands.each do |key, data|
# Skip non-primary commands. These only show up in extended
# help output.
next if !data[1][:primary]
key = key.to_s
klass = data[0].call
commands[key] = klass.synopsis

View File

@ -42,15 +42,15 @@ describe Vagrant::CLI do
describe "#help" do
subject { described_class.new([], env) }
it "includes all available subcommands" do
commands[:foo] = [command_lambda("foo", 0), {}]
commands[:bar] = [command_lambda("bar", 0), {}]
commands[:baz] = [command_lambda("baz", 0), {}]
it "includes all primary subcommands" do
commands[:foo] = [command_lambda("foo", 0), { primary: true }]
commands[:bar] = [command_lambda("bar", 0), { primary: true }]
commands[:baz] = [command_lambda("baz", 0), { primary: false }]
env.ui.should_receive(:info).with do |message, opts|
expect(message).to include("foo")
expect(message).to include("bar")
expect(message).to include("baz")
expect(message.include?("baz")).to be_false
end
subject.help