Skip to content

Commit

Permalink
Add step and delete commands
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Nov 19, 2022
1 parent 2e46ec6 commit ca62e66
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/irb/cmd/delete.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require_relative "debug"

module IRB
# :stopdoc:

module ExtendCommand
class Delete < Debug
def execute(*args)
super(pre_cmds: ["delete", *args].join(" "))
end
end
end

# :startdoc:
end
18 changes: 18 additions & 0 deletions lib/irb/cmd/step.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

require_relative "debug"

module IRB
# :stopdoc:

module ExtendCommand
class Step < Debug
def execute(*args)
# Run `next` first to move out of binding.irb
super(pre_cmds: "next", do_cmds: ["step", *args].join(" "))
end
end
end

# :startdoc:
end
8 changes: 8 additions & 0 deletions lib/irb/extend-command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ def irb_context
[
:irb_next, :Next, "cmd/next",
],
[
:irb_delete, :Delete, "cmd/delete",
[:delete, NO_OVERRIDE],
],
[
:irb_step, :Step, "cmd/step",
[:step, NO_OVERRIDE],
],
[
:irb_continue, :Continue, "cmd/continue",
[:continue, NO_OVERRIDE],
Expand Down

0 comments on commit ca62e66

Please sign in to comment.