From 553855ff5625c59fd08eab898b15a0d794152adc Mon Sep 17 00:00:00 2001 From: epitron Date: Sun, 26 Aug 2012 13:28:12 -0400 Subject: [PATCH 1/3] Rename 'show-stack' to 'stack' 'show-stack' is now an alias to 'stack' (for backwards compatability) --- lib/pry-stack_explorer/commands.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/pry-stack_explorer/commands.rb b/lib/pry-stack_explorer/commands.rb index 90a8b2e..48b5434 100644 --- a/lib/pry-stack_explorer/commands.rb +++ b/lib/pry-stack_explorer/commands.rb @@ -231,11 +231,11 @@ def process end end - create_command "show-stack", "Show all frames" do + create_command "stack", "Show all frames" do include FrameHelpers banner <<-BANNER - Usage: show-stack [OPTIONS] + Usage: stack [OPTIONS] Show all accessible stack frames. e.g: show-stack -v BANNER @@ -309,5 +309,8 @@ def process end end + + alias_command "show-stack", "stack" + end end From d55864613f1e8744af6ff2aafae2394018067a17 Mon Sep 17 00:00:00 2001 From: Jonathan Allard Date: Wed, 24 Jun 2020 22:09:37 -0400 Subject: [PATCH 2/3] Rename to 'stack': Add tests --- test/commands_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/commands_test.rb b/test/commands_test.rb index eb8a429..6c06efe 100644 --- a/test/commands_test.rb +++ b/test/commands_test.rb @@ -49,6 +49,20 @@ def bang Pry.config.hooks.delete_hook(:after_session, :delete_frame_manager) end + describe "stack" do + it "outputs the call stack" do + output = issue_pry_commands("stack"){ bingbong.bing } + + expect(output).to match(/bang.*?bong.*?bing/m) + end + + it "supports 'show-stack' as an alias" do + output = issue_pry_commands("show-stack"){ bingbong.bing } + + expect(output).to match(/bang.*?bong.*?bing/m) + end + end + describe "up" do it 'should move up the call stack one frame at a time' do redirect_pry_io(InputTester.new("@methods << __method__", From 3c3346fa4337091ebdef1927e7309334db0a431f Mon Sep 17 00:00:00 2001 From: Jonathan Allard Date: Wed, 24 Jun 2020 22:25:16 -0400 Subject: [PATCH 3/3] Changelog, Readme, housekeeping --- CHANGELOG | 2 ++ README.md | 4 ++-- lib/pry-stack_explorer/commands.rb | 4 +++- test/stack_explorer_test.rb | 6 +++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 03f4afa..58891ae 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Rename 'show-stack' to 'stack' (#50, #8) + ## v0.5.1 (21 May 2020) * Fix exception in started hook diff --git a/README.md b/README.md index 6e38823..ccdb1e0 100755 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Unlike `ruby-debug`, pry-stack_explorer incurs no runtime cost and enables navigation right up the call-stack to the birth of the program. -The `up`, `down`, `frame` and `show-stack` commands are provided. See +The `up`, `down`, `frame` and `stack` commands are provided. See Pry's in-session help for more information on any of these commands. ## Usage @@ -26,7 +26,7 @@ Provides commands available in Pry sessions. Commands: * `up`/`down` - Move up or down the call stack * `frame [n]` - Go to frame *n* -* `show-stack` - Show call stack +* `stack` - Show call stack ## Install diff --git a/lib/pry-stack_explorer/commands.rb b/lib/pry-stack_explorer/commands.rb index 48b5434..a5cec32 100644 --- a/lib/pry-stack_explorer/commands.rb +++ b/lib/pry-stack_explorer/commands.rb @@ -237,7 +237,9 @@ def process banner <<-BANNER Usage: stack [OPTIONS] Show all accessible stack frames. - e.g: show-stack -v + e.g: stack -v + + alias: show-stack BANNER def options(opt) diff --git a/test/stack_explorer_test.rb b/test/stack_explorer_test.rb index 3026e8f..0d321b0 100644 --- a/test/stack_explorer_test.rb +++ b/test/stack_explorer_test.rb @@ -99,7 +99,7 @@ def o.==(other) describe ":call_stack option" do it 'should invoke a session with the call stack set' do - redirect_pry_io(StringIO.new("show-stack\nexit\n"), out=StringIO.new) do + redirect_pry_io(StringIO.new("stack\nexit\n"), out=StringIO.new) do @o.bing end @@ -112,7 +112,7 @@ def o.bing() bong end def o.bong() bang end def o.bang() Pry.start(binding, :call_stack => false) end - redirect_pry_io(StringIO.new("show-stack\nexit\n"), out=StringIO.new) do + redirect_pry_io(StringIO.new("stack\nexit\n"), out=StringIO.new) do o.bing end @@ -125,7 +125,7 @@ def o.alpha() binding end def o.beta() binding end def o.gamma() binding end - redirect_pry_io(StringIO.new("show-stack\nexit\n"), out=StringIO.new) do + redirect_pry_io(StringIO.new("stack\nexit\n"), out=StringIO.new) do Pry.start(binding, :call_stack => [o.beta, o.gamma, o.alpha]) end