Skip to content

Commit

Permalink
Merge pull request #63 from CocoaPods/seg-argument-suggester-question
Browse files Browse the repository at this point in the history
[ArgumentSuggester] Add a question mark after did you mean
  • Loading branch information
segiddins committed Mar 10, 2016
2 parents 46c7f6e + 40dceff commit d9c7016
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/claide/command/argument_suggester.rb
Expand Up @@ -45,7 +45,7 @@ def suggestion
pretty_suggestion = self.class.prettify_suggestion(suggestion,
@argument_type)
"Unknown #{argument_description}: `#{@argument}`\n" \
"Did you mean: #{pretty_suggestion}"
"Did you mean: #{pretty_suggestion}?"
else
"Unknown #{argument_description}: `#{@argument}`"
end
Expand All @@ -64,7 +64,7 @@ def suggestion
def self.prettify_suggestion(suggestion, argument_type)
case argument_type
when :option, :flag
suggestion = "#{suggestion}"
suggestion = suggestion.to_s
suggestion.ansi.blue
when :arg
suggestion.ansi.green
Expand Down
5 changes: 3 additions & 2 deletions spec/command/argument_suggester_spec.rb
Expand Up @@ -32,7 +32,8 @@ class CLAide::Command
describe '#suggestion' do
it 'returns the message for a command' do
result = ArgumentSuggester.new('spec_file', Fixture::Command).suggestion
result.should == "Unknown command: `spec_file`\nDid you mean: spec-file"
result.
should == "Unknown command: `spec_file`\nDid you mean: spec-file?"
end

it 'returns the message for when no suggestion is possible' do
Expand All @@ -43,7 +44,7 @@ class CLAide::Command

it 'returns the message for an option' do
result = ArgumentSuggester.new('--verbosa', Fixture::Command).suggestion
result.should == "Unknown option: `--verbosa`\nDid you mean: --verbose"
result.should == "Unknown option: `--verbosa`\nDid you mean: --verbose?"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/command_spec.rb
Expand Up @@ -153,12 +153,12 @@ module CLAide
end

it 'raises a Help exception when created with an invalid subcommand' do
message = "Unknown command: `unknown`\nDid you mean: spec-file"
message = "Unknown command: `unknown`\nDid you mean: spec-file?"
should_raise_help message do
@command.parse(%w(unknown)).validate!
end

should_raise_help "Unknown command: `unknown`\nDid you mean: lint" do
should_raise_help "Unknown command: `unknown`\nDid you mean: lint?" do
@command.parse(%w(spec-file unknown)).validate!
end
end
Expand Down

0 comments on commit d9c7016

Please sign in to comment.