summaryrefslogtreecommitdiff
path: root/lib/irb/command
AgeCommit message (Collapse)Author
2025-01-24Migrate irb and reline to the bundled gemsHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12624
2025-01-22[ruby/irb] Update documentation about the new copy commandStan Lo
(https://github.com/ruby/irb/pull/1067) https://github.com/ruby/irb/commit/6194111611 Notes: Merged: https://github.com/ruby/ruby/pull/12612
2025-01-22[ruby/irb] Show a quick preview of inspect result before pagertomoya ishida
launch (https://github.com/ruby/irb/pull/1040) * Quickly show inspect preview even if pretty_print takes too much time * Show a message "Inspecting..." while generating pretty_print content * Update inspecting message Co-authored-by: Stan Lo <[email protected]> * Update rendering test for preparing inspect message * Don't show preview if pretty_print does not take time --------- https://github.com/ruby/irb/commit/03c36586e6 Co-authored-by: Stan Lo <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/12612
2025-01-22[ruby/irb] Add copy command (https://github.com/ruby/irb/pull/1044)Prajjwal Singh
Closes https://github.com/ruby/irb/pull/753 https://github.com/ruby/irb/commit/a24ac53d48 Notes: Merged: https://github.com/ruby/ruby/pull/12612
2024-12-29[ruby/irb] Fix broken `history` command with -gsanfrecce-osaka
(https://github.com/ruby/irb/pull/1057) Local variable `grep` was always nil because the regular expression parsing options contained an unnecessary `\n`. `test_history_grep` did not detect this because it only asserted what was included in the output. https://github.com/ruby/irb/commit/a282bbc0cf
2024-12-13[ruby/irb] Avoid generating documentation pages for internalStan Lo
components (https://github.com/ruby/irb/pull/1047) https://github.com/ruby/irb/commit/f57025a35e
2024-12-03[ruby/irb] Don't show 'Maybe IRB bug!' in show_source and ls commandtomoya ishida
(https://github.com/ruby/irb/pull/1039) https://github.com/ruby/irb/commit/9eb14a3a0b
2024-11-19[ruby/irb] Don't use delegator to install helper methods to maintomoya ishida
object (https://github.com/ruby/irb/pull/1031) IRB used delegator to install command as a method of frozen main object. Command is not a method now. We can drop it. https://github.com/ruby/irb/commit/2f1c593801
2024-09-12[ruby/irb] Remove KEYWORD_ALIASES which handled special alias nametomoya ishida
of irb_break irb_catch and irb_next command (https://github.com/ruby/irb/pull/1004) * Remove KEYWORD_ALIASES which handled special alias name of irb_break irb_catch and irb_next command * Remove unused instance variable user_aliases Co-authored-by: Stan Lo <[email protected]> --------- https://github.com/ruby/irb/commit/f256d7899f Co-authored-by: Stan Lo <[email protected]>
2024-07-16[ruby/irb] Group class methods under `class << self`Stan Lo
(https://github.com/ruby/irb/pull/981) https://github.com/ruby/irb/commit/cdaa356df2
2024-07-03[ruby/irb] Introduce cd commandStan Lo
(https://github.com/ruby/irb/pull/971) It's essentially a combination of pushws and popws commands that are easier to use. Help message: ``` Usage: cd ([target]|..) IRB uses a stack of workspaces to keep track of context(s), with `pushws` and `popws` commands to manipulate the stack. The `cd` command is an attempt to simplify the operation and will be subject to change. When given: - an object, cd will use that object as the new context by pushing it onto the workspace stack. - "..", cd will leave the current context by popping the top workspace off the stack. - no arguments, cd will move to the top workspace on the stack by popping off all workspaces. Examples: cd Foo cd Foo.new cd @ivar cd .. cd ``` https://github.com/ruby/irb/commit/4a0e0e89b7
2024-05-04[ruby/irb] Improve help message for no meta commandsStan Lo
(https://github.com/ruby/irb/pull/948) * Remove unnecessary code from command tests * Improve help message for no meta commands 1. Add placeholder values for both command category and description 2. Update help command's output to give different types of categories more explicit ordering https://github.com/ruby/irb/commit/b1ef58aeff
2024-05-04[ruby/irb] Use flag instead of caller for `debug`'s binding.irbStan Lo
check (https://github.com/ruby/irb/pull/947) https://github.com/ruby/irb/commit/4a4d7a4279
2024-05-03[ruby/irb] Avoid raising errors while running help for customKenichi Kamiya
commands (https://github.com/ruby/irb/pull/944) * Avoid raising errors while running help for custom commands Raising an error from the help command is not a pleasure for the end user, even if the command does not define any attributes * Update test/irb/command/test_custom_command.rb --------- https://github.com/ruby/irb/commit/c8bba9f8dc Co-authored-by: Stan Lo <[email protected]>
2024-04-26[ruby/irb] Suppress command return valuesStan Lo
(https://github.com/ruby/irb/pull/934) Since commands can't be chained with methods, their return values are not intended to be used. But if IRB keeps storing command return values as the last value, and print them, users may rely on such implicit behaviour. So to avoid such confusion, this commit suppresses command's return values. It also updates some commands that currently rely on this implicit behaviour. https://github.com/ruby/irb/commit/fa96bea76f
2024-04-23Sync IRB f9347b1 (#10611)Stan Lo
2024-04-20[ruby/irb] Stop using ExtendCommandBundle internallyStan Lo
(https://github.com/ruby/irb/pull/925) This module was used to extend both commands and helpers when they're not separated. Now that they are, and we have a Command module, we should move command-related logic to the Command module and update related references. This will make the code easier to understand and refactor in the future. https://github.com/ruby/irb/commit/f74ec97236
2024-04-20[ruby/irb] Remove exit command workaround, handle IRB_EXIT intomoya ishida
debug_readline (https://github.com/ruby/irb/pull/923) * Remove exit and exti! command workaround when executed outside of IRB Command was a method. It could be executed outside of IRB. Workaround for it is no longer needed. * Handle IRB_EXIT in debug mode * Add exit and exit! command in rdbg mode https://github.com/ruby/irb/commit/0b5dd6afd0
2024-04-17[ruby/irb] Remove internal-only methods from Command::Basetomoya ishida
(https://github.com/ruby/irb/pull/922) * Remove internal-only methods from Command::Base Command#ruby_args and Command#unwrap_string_literal are used for default command's argument backward compatibility. Moved these methods to another module to avoid being used from custom commands. * Update lib/irb/command/edit.rb --------- https://github.com/ruby/irb/commit/7405a841e8 Co-authored-by: Stan Lo <[email protected]>
2024-04-14[ruby/irb] Allow defining custom commands in IRBStan Lo
(https://github.com/ruby/irb/pull/886) This is a feature that has been requested for a long time. It is now possible to define custom commands in IRB. Example usage: ```ruby require "irb/command" class HelloCommand < IRB::Command::Base description "Prints hello world" category "My commands" help_message "It doesn't do more than printing hello world." def execute puts "Hello world" end end IRB::Command.register(:hello, HelloCommand) ``` https://github.com/ruby/irb/commit/888643467c
2024-04-10[ruby/irb] Centralize rstrip callsStan Lo
(https://github.com/ruby/irb/pull/918) https://github.com/ruby/irb/commit/97898b6251
2024-04-10[ruby/irb] Command implementation not by methodtomoya ishida
(https://github.com/ruby/irb/pull/824) * Command is not a method * Fix command test * Implement non-method command name completion * Add test for ExtendCommandBundle.def_extend_command * Add helper method install test * Remove spaces in command input parse * Remove command arg unquote in help command * Simplify Statement and handle execution in IRB::Irb * Tweak require, const name * Always install CommandBundle module to main object * Remove considering local variable in command or expression check * Remove unused method, tweak * Remove outdated comment for help command arg Co-authored-by: Stan Lo <[email protected]> --------- https://github.com/ruby/irb/commit/8fb776e379 Co-authored-by: Stan Lo <[email protected]>
2024-03-16[ruby/irb] Fix irb_history saved to current directorytomoya ishida
(https://github.com/ruby/irb/pull/901) * Always save irb_history in HOME or XDG_CONFIG_HOME Also split irbrc search logic from irb_history search logic as a refactor * Remove IRB.conf[:RC_NAME_GENERATOR] because it's not configurable This conf is used to specify which irbrc to load. Need to configure before irbrc is loaded, so it's actually not configurable. This conf is also used for history file search, but it is configurable by conf[:HISTORY_FILE]. * remove rc_file_test because it is tested with rc_files, remove useless test setup * Make internal irbrc searching method private https://github.com/ruby/irb/commit/11d03a6ff7
2024-03-14[ruby/irb] Add disable_irb command to disable debug of binding.irbhogelog
(https://github.com/ruby/irb/pull/898) * Add disable_irb command to disable debug of binding.irb * disable_irb doesn't override Kernel.exit Kernel.exit call is removed because disable_irb does not override Kernel.exit and workaround to https://bugs.ruby-lang.org/issues/18234 is not needed. https://github.com/ruby/irb/commit/29901e4f21
2024-03-05[ruby/irb] Add the ability to fetch and load multiple irb files.Haroon Ahmed
(https://github.com/ruby/irb/pull/859) This allows hierarchy when loading rc files for example both files below are loaded; project/.irbrc ~/.irbrc https://github.com/ruby/irb/commit/b53ebc6655 Co-authored-by: Stan Lo <[email protected]>
2024-03-01[ruby/irb] Restructure workspace managementStan Lo
(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 https://github.com/ruby/irb/commit/61560b99b3
2024-02-25[ruby/irb] Add help messages to `show_source` and `show_doc`Stan Lo
commands (https://github.com/ruby/irb/pull/887) * Add help message to the show_source command * Add help message to the show_doc command https://github.com/ruby/irb/commit/06f43aadb3
2024-02-23[ruby/irb] Turn on frozen literal in filesStan Lo
(https://github.com/ruby/irb/pull/881) https://github.com/ruby/irb/commit/83d90550c2
2024-02-19[ruby/irb] Fix `irb:rdbg` for ruby headStan Lo
(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] --------- https://github.com/ruby/irb/commit/ebffd3d976 Co-authored-by: Yusuke Endoh <[email protected]>
2024-02-18[ruby/irb] Revamp `help` commandStan Lo
(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 https://github.com/ruby/irb/commit/43a2c99f3f
2024-02-16[ruby/irb] Standardize command related namesStan Lo
(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 https://github.com/ruby/irb/commit/462c1284af