Commit graph

6 commits

Author SHA1 Message Date
Stan Lo
57ca5960ad [ruby/irb] Restructure workspace management
(https://github.com/ruby/irb/pull/888)

* Remove dead irb_level method

* Restructure workspace management

Currently, workspace is an attribute of IRB::Context in most use cases.
But when some workspace commands are used, like `pushws` or `popws`, a
workspace will be created and used along side with the original workspace
attribute.

This complexity is not necessary and will prevent us from expanding
multi-workspace support in the future.

So this commit introduces a @workspace_stack ivar to IRB::Context so IRB
can have a more natural way to manage workspaces.

* Fix pushws without args

* Always display workspace stack after related commands are used

61560b99b3
2024-03-01 15:51:29 +00:00
Stan Lo
c976cb52a2 [ruby/irb] Add help messages to show_source and show_doc
commands
(https://github.com/ruby/irb/pull/887)

* Add help message to the show_source command

* Add help message to the show_doc command

06f43aadb3
2024-02-25 15:22:33 +00:00
Stan Lo
4831bb5bab [ruby/irb] Turn on frozen literal in files
(https://github.com/ruby/irb/pull/881)

83d90550c2
2024-02-23 10:53:53 +00:00
Stan Lo
7e577e150a [ruby/irb] Fix irb:rdbg for ruby head
(https://github.com/ruby/irb/pull/876)

* Update binding.irb check for Ruby head

With https://github.com/ruby/ruby/pull/9605, backtrace in Ruby head
now has a new format. This commit updates the check for binding.irb
to work with Ruby head.

* Do not include a backtick in error messages and backtraces

[Feature #16495]

---------

ebffd3d976

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
2024-02-19 11:01:30 +09:00
Stan Lo
07c774e85c [ruby/irb] Revamp help command
(https://github.com/ruby/irb/pull/877)

* Make help command display help for individual commands

Usage: `help [command]`

If the command is not specified, it will display a list of all available commands.

If the command is specified, it will display the banner OR description of the command.

If the command is not found, it will display a message saying that the command is not found.

* Rename test/irb/cmd to test/irb/command

* Add banner to edit and ls commands

* Promote help command in the help message

1. Make `show_cmds` an alias of `help` so it's not displayed in the help message
2. Update description of the help command to reflect `help <command>` syntax

* Rename banner to help_message

43a2c99f3f
2024-02-18 18:21:08 +00:00
Stan Lo
f5801e2bf4 [ruby/irb] Standardize command related names
(https://github.com/ruby/irb/pull/873)

* Replace ExtendCommand with Command and standardize command related names

1. Rename lib/irb/extend-command.rb to lib/irb/command.rb
2. Rename lib/irb/cmd/*.rb to lib/irb/command/*.rb
3. Rename test/irb/test_cmd.rb to test/irb/test_command.rb
4. Rename ExtendCommand to Command

* Alias ExtendCommand to Command and deprecate it

* Rename Command::Nop to Command::Base

* Not deprecate old constants just yet

* Add lib/irb/cmd/nop.rb back

462c1284af
2024-02-16 16:47:36 +00:00