Skip to content

Commit ca62e66

Browse files
committed
Add step and delete commands
1 parent 2e46ec6 commit ca62e66

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

lib/irb/cmd/delete.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
require_relative "debug"
4+
5+
module IRB
6+
# :stopdoc:
7+
8+
module ExtendCommand
9+
class Delete < Debug
10+
def execute(*args)
11+
super(pre_cmds: ["delete", *args].join(" "))
12+
end
13+
end
14+
end
15+
16+
# :startdoc:
17+
end

lib/irb/cmd/step.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# frozen_string_literal: true
2+
3+
require_relative "debug"
4+
5+
module IRB
6+
# :stopdoc:
7+
8+
module ExtendCommand
9+
class Step < Debug
10+
def execute(*args)
11+
# Run `next` first to move out of binding.irb
12+
super(pre_cmds: "next", do_cmds: ["step", *args].join(" "))
13+
end
14+
end
15+
end
16+
17+
# :startdoc:
18+
end

lib/irb/extend-command.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ def irb_context
126126
[
127127
:irb_next, :Next, "cmd/next",
128128
],
129+
[
130+
:irb_delete, :Delete, "cmd/delete",
131+
[:delete, NO_OVERRIDE],
132+
],
133+
[
134+
:irb_step, :Step, "cmd/step",
135+
[:step, NO_OVERRIDE],
136+
],
129137
[
130138
:irb_continue, :Continue, "cmd/continue",
131139
[:continue, NO_OVERRIDE],

0 commit comments

Comments
 (0)