diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2019-09-03 14:20:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-03 14:20:42 +0800 |
commit | fa97d5c2997ff1cf03cf925df482a7a1d9ca3ea3 (patch) | |
tree | 528445547f3e698f4189a4cf361f891218444494 | |
parent | 46a99cb6c04f66b0ea8051c696f1d25c6303b5d3 (diff) | |
parent | 113670040c5fa890004dbd59dfd336d829d336e5 (diff) | |
download | pry-fa97d5c2997ff1cf03cf925df482a7a1d9ca3ea3.tar.gz |
Merge pull request #2070 from bcgraham/fix-show-negative-range
Allow negative ranges in hist --show
-rw-r--r-- | lib/pry/commands/hist.rb | 2 | ||||
-rw-r--r-- | spec/commands/hist_spec.rb | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/pry/commands/hist.rb b/lib/pry/commands/hist.rb index 390e992d..332176d2 100644 --- a/lib/pry/commands/hist.rb +++ b/lib/pry/commands/hist.rb @@ -52,8 +52,6 @@ class Pry @history.take_lines(1, opts[:head] || 10) elsif opts.present?(:tail) @history.take_lines(-(opts[:tail] || 10), opts[:tail] || 10) - elsif opts.present?(:show) - @history.between(opts[:show]) else @history end diff --git a/spec/commands/hist_spec.rb b/spec/commands/hist_spec.rb index 2fbbffb6..3563d3e9 100644 --- a/spec/commands/hist_spec.rb +++ b/spec/commands/hist_spec.rb @@ -132,6 +132,15 @@ describe "hist" do expect(out).to match(/b\n\d+:.*c\n\d+:.*d/) end + it 'should show lines between offsets A and B with the --show switch' do + ("a".."f").each do |v| + @hist.push v + end + + out = @t.eval 'hist --show -4..-2' + expect(out).to eq "3: c\n4: d\n5: e\n" + end + it "should store a call with `--replay` flag" do @t.eval ":banzai" @t.eval "hist --replay 1" |