Commit a725d61a authored by Marin Usalj's avatar Marin Usalj

Added help command. Usage `pod help [COMMAND]`

parent 9b070759
......@@ -16,6 +16,7 @@ module Pod
require 'cocoapods/command/search'
require 'cocoapods/command/setup'
require 'cocoapods/command/spec'
require 'cocoapods/command/help'
require 'cocoapods/command/inter_process_communication'
self.abstract_command = true
......
module Pod
class Command
class Help < Command
self.summary = 'Show help for the given command'
self.arguments = '[COMMAND]'
def self.parse(argv)
command_needs_help = [argv.shift_argument, '--help']
argv.empty? ? super : Pod::Command.parse(command_needs_help)
end
def run
help!
end
end
end
end
\ No newline at end of file
Subproject commit e54bfaa54110629cbb7495a5cdbb237b1fffe8f8
Subproject commit ee564d9da8878957e7b77cac987d9601eb04eca5
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe "Command::Help" do
extend SpecHelper::Command
it "invokes the right command with --help flag" do
command = command('help', 'push')
command.should.be.instance_of Pod::Command::Push
lambda { command.validate! }.should.raise CLAide::Help
end
it "raises help! if no other command is passed" do
lambda { command('help').validate! }.should.raise CLAide::Help
end
it "shows the right usage" do
Pod::Command::Help.arguments.should.equal '[COMMAND]'
end
end
end
\ No newline at end of file
......@@ -3,6 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Command do
it "returns the proper command class" do
Command.parse(%w{ help }).should.be.instance_of Command::Help
Command.parse(%w{ install }).should.be.instance_of Command::Install
Command.parse(%w{ list }).should.be.instance_of Command::List
Command.parse(%w{ outdated }).should.be.instance_of Command::Outdated
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment