mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Allow negative ranges in hist --show
Remove duplicate `opts[:show]` check in hist.
This commit is contained in:
parent
846b7ecb6f
commit
113670040c
2 changed files with 9 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue