Feature Request: Equivalent to Pry’s !!! in IRB for Exiting Nested Contexts
antonyr opened this issue · 2 comments
Description
What are your expected behavior and actual behavior of your environment?
Result of irb_info
irb(main):001:0> irb_info
=>
Ruby version: 3.3.0
IRB version: irb 1.12.0 (2024-03-06)
InputMethod: RelineInputMethod with Reline 0.4.3
Completion: Autocomplete, RegexpCompletor
RUBY_PLATFORM: arm64-darwin23
LANG env: en_US.UTF-8
LC_ALL env: en_US.UTF-8
East Asian Ambiguous Width: 1
Terminal Emulator
What's your terminal emulator?
Alacritty
Setting Files
Are you using ~/.irbrc
and ~/.inputrc
?
Nope
Feature Request
I propose the introduction of a similar feature in IRB. While IRB allows users to exit sessions with exit
or quit
, and to navigate out of nested contexts by repeatedly using these commands, an equivalent single command to Pry's !!!
would enhance the user experience.
Expected Behavior
The implementation of this feature would provide a single command that, when executed, would immediately exit all nested contexts and return the user to the top-level binding. If executed at the top-level, it would exit the IRB session.
Actual Behavior
Currently, users must manually issue the exit
or quit
command multiple times to navigate out of nested contexts or end the session.
Steps to Reproduce
- Enter a nested context in IRB (e.g., by opening a class or module definition).
- Attempt to exit to the top-level binding or end the session with a single command (current behavior requires multiple
exit
orquit
commands).
Additional Context
This feature would align IRB more closely with Pry in terms of usability and provide a smoother workflow for developers who frequently work with nested contexts.
Thank you for considering this feature request.
IRB has a command called exit!
, which should do exactly this. Can you give it a try?