diff options
author | Conrad Irwin <conrad.irwin@gmail.com> | 2012-11-14 01:52:21 -0800 |
---|---|---|
committer | Conrad Irwin <conrad.irwin@gmail.com> | 2012-11-14 01:54:30 -0800 |
commit | 7a5d21ba746c49a0d3d344553e9c43bbb89cd57e (patch) | |
tree | 5f9e82d2233330f0231e8078b983736da25f7313 | |
parent | b18a52f9a50957ba9ca792c0c11b89a406a4208f (diff) | |
download | pry-7a5d21ba746c49a0d3d344553e9c43bbb89cd57e.tar.gz |
Add a space when completing command names and long options
-rw-r--r-- | lib/pry/command.rb | 2 | ||||
-rw-r--r-- | lib/pry/command_set.rb | 2 | ||||
-rw-r--r-- | test/test_command.rb | 2 | ||||
-rw-r--r-- | test/test_command_set.rb | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/pry/command.rb b/lib/pry/command.rb index 27d78a8a..b10b6147 100644 --- a/lib/pry/command.rb +++ b/lib/pry/command.rb @@ -513,7 +513,7 @@ class Pry # @return [Array<String>] the words to complete def complete(search) slop.map do |opt| - [opt.long && "--#{opt.long}" || opt.short && "-#{opt.short}"] + [opt.long && "--#{opt.long} " || opt.short && "-#{opt.short}"] end.flatten(1).compact + super end diff --git a/lib/pry/command_set.rb b/lib/pry/command_set.rb index 231b761c..49d9fb63 100644 --- a/lib/pry/command_set.rb +++ b/lib/pry/command_set.rb @@ -365,7 +365,7 @@ class Pry else commands.keys.select do |x| String === x && x.start_with?(search) - end + Bond::DefaultMission.completions + end.map{ |command| command + " " } + Bond::DefaultMission.completions end end diff --git a/test/test_command.rb b/test/test_command.rb index 3e5e72e0..7c037e74 100644 --- a/test/test_command.rb +++ b/test/test_command.rb @@ -666,7 +666,7 @@ describe "Pry::Command" do end end - @set.complete('torrid ').should.include('--test') + @set.complete('torrid ').should.include('--test ') end end end diff --git a/test/test_command_set.rb b/test/test_command_set.rb index 5cf4b406..15fd7be8 100644 --- a/test/test_command_set.rb +++ b/test/test_command_set.rb @@ -615,7 +615,7 @@ describe Pry::CommandSet do describe '.complete' do it "should list all command names" do @set.create_command('susan'){ } - @set.complete('sus').should.include 'susan' + @set.complete('sus').should.include 'susan ' end it "should delegate to commands" do |