irb 1.14.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.rdoc_options +5 -0
  3. data/CONTRIBUTING.md +52 -0
  4. data/EXTEND_IRB.md +3 -0
  5. data/Gemfile +11 -1
  6. data/README.md +13 -293
  7. data/doc/COMMAND_LINE_OPTIONS.md +69 -0
  8. data/doc/COMPARED_WITH_PRY.md +22 -0
  9. data/doc/Configurations.md +274 -0
  10. data/doc/EXTEND_IRB.md +122 -0
  11. data/doc/Index.md +705 -0
  12. data/doc/irb/irb.rd.ja +1 -1
  13. data/lib/irb/color.rb +251 -162
  14. data/lib/irb/color_printer.rb +10 -9
  15. data/lib/irb/command/base.rb +46 -13
  16. data/lib/irb/command/copy.rb +83 -0
  17. data/lib/irb/command/debug.rb +8 -6
  18. data/lib/irb/command/help.rb +1 -1
  19. data/lib/irb/command/history.rb +1 -1
  20. data/lib/irb/command/internal_helpers.rb +7 -4
  21. data/lib/irb/command/ls.rb +29 -15
  22. data/lib/irb/completion.rb +81 -57
  23. data/lib/irb/context.rb +132 -53
  24. data/lib/irb/debug/ui.rb +2 -4
  25. data/lib/irb/debug.rb +9 -12
  26. data/lib/irb/default_commands.rb +19 -8
  27. data/lib/irb/easter-egg.rb +13 -7
  28. data/lib/irb/ext/multi-irb.rb +2 -0
  29. data/lib/irb/history.rb +84 -55
  30. data/lib/irb/init.rb +7 -2
  31. data/lib/irb/input-method.rb +167 -130
  32. data/lib/irb/inspector.rb +42 -36
  33. data/lib/irb/lc/help-message +2 -2
  34. data/lib/irb/lc/ja/help-message +4 -4
  35. data/lib/irb/nesting_parser.rb +364 -213
  36. data/lib/irb/pager.rb +137 -7
  37. data/lib/irb/ruby-lex.rb +230 -302
  38. data/lib/irb/ruby_logo.aa +79 -37
  39. data/lib/irb/source_finder.rb +15 -22
  40. data/lib/irb/startup_message.rb +83 -0
  41. data/lib/irb/statement.rb +21 -0
  42. data/lib/irb/version.rb +2 -2
  43. data/lib/irb/workspace.rb +22 -31
  44. data/lib/irb.rb +148 -986
  45. data/man/irb.1 +37 -2
  46. metadata +42 -12
  47. data/.document +0 -4
  48. data/Rakefile +0 -54
  49. data/bin/console +0 -6
  50. data/bin/setup +0 -6
  51. data/irb.gemspec +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b96add3ef12d981b483ae225bfd8bca8a1a477f0b03c8040a0dfbf047bd0d1fb
4
- data.tar.gz: efe91e97fab6b11a239c4774da9d5ecfe39bbc364d61a6b2c7fd6ec8b9c01a72
3
+ metadata.gz: f5228c22000696caa8318b56171e1238202f103e63c470db4d215ce2d0e46625
4
+ data.tar.gz: ac556bc9f4fe3abfef0310a1330d609d424c1196e4a75ba086bae789b0e973d1
5
5
  SHA512:
6
- metadata.gz: 0eaa119e765d958cdab2ba80fa12e47a9727d389a37f255e174ec260279af8e2c2edb510689364541fe40f3c202a3b3d4f2d7dc7fbe30030b04e89bc2c851a3a
7
- data.tar.gz: 71904280b978ac48763d7bc965f053fd5580ec7876c40cba76a1a9c26ac7aec2f4ad98deb1d9c8d3635f5222a0b757d458d7fded9264411b05f19bfe77ad2526
6
+ metadata.gz: fe37b6ecb5348d4cee255f42fd0be29d75b609b7edf45e0e8b6699dcb2865c4d888fbb282087acbfe2eaa9235890e60f7be80545ddb292b9adb4d4c29fd8b111
7
+ data.tar.gz: 063aab58e48c5ff5e6bb5ca306ad820469c96a691d1f90d227a045c6fb2d9a5b423c76e4099a213fee21f079c52839556e13b8a8529779df982f418756eb89ff
data/.rdoc_options ADDED
@@ -0,0 +1,5 @@
1
+ page_dir: doc
2
+ warn_missing_rdoc_ref: true
3
+
4
+ autolink_excluded_words:
5
+ - IRB
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,52 @@
1
+ # Contributing to IRB
2
+
3
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/ruby/irb](https://github.com/ruby/irb).
4
+
5
+ ## Set up the environment
6
+
7
+ 1. Fork the project to your GitHub account.
8
+ 2. Clone the fork with `git clone git@github.com:[your_username]/irb.git`.
9
+ 3. Run `bundle install`.
10
+ 4. Run `bundle exec rake` to make sure tests pass locally.
11
+
12
+ ## Run integration tests
13
+
14
+ If your changes affect component rendering, such as the autocompletion's dialog/dropdown, you may need to run IRB's integration tests, known as `yamatanooroti`.
15
+
16
+ Before running these tests, ensure that you have `libvterm` installed. If you're using Homebrew, you can install it by running:
17
+
18
+ ```bash
19
+ brew install libvterm
20
+ ```
21
+
22
+ After installing `libvterm`, you can run the integration tests using the following commands:
23
+
24
+ ```bash
25
+ WITH_VTERM=1 bundle install
26
+ WITH_VTERM=1 bundle exec rake test test_yamatanooroti
27
+ ```
28
+
29
+ ## Update documentation
30
+
31
+ IRB's documentation is generated by [RDoc](https://ruby.github.io/rdoc/) and published to [ruby.github.io/irb](https://ruby.github.io/irb/). Most of the documentation source lives under the `doc/` directory.
32
+
33
+ Run the following command to generate the documentation site locally.
34
+
35
+ ```bash
36
+ bundle exec rake rdoc
37
+ bundle exec rake rerdoc # to force regeneration
38
+ ```
39
+
40
+ Follow the output message to open the documentation site in your browser.
41
+
42
+ > [!Note]
43
+ >
44
+ > Please ensure that the changes are rendered correctly on the documentation site.
45
+ > RDoc's Markdown support is limited, so the rendered result on GitHub might differ from what’s rendered on [https://ruby.github.io/irb](https://ruby.github.io/irb).
46
+
47
+ We welcome any improvements to the documentation, including:
48
+
49
+ - Fixing typos and grammatical errors.
50
+ - Adding missing documentation for features.
51
+ - Adding missing documentation for configuration options.
52
+ - Adding demo images/gifs for features.
data/EXTEND_IRB.md ADDED
@@ -0,0 +1,3 @@
1
+ # Extend IRB
2
+
3
+ This page has been moved to the [IRB Extension Guide](https://ruby.github.io/irb/EXTEND_IRB_md.html).
data/Gemfile CHANGED
@@ -20,7 +20,17 @@ gem "test-unit-ruby-core"
20
20
  gem "rubocop"
21
21
 
22
22
  gem "tracer" if !is_truffleruby
23
- gem "debug", github: "ruby/debug", platforms: [:mri, :mswin]
23
+ gem "debug", github: "ruby/debug"
24
+
25
+ gem "rdoc", ">= 6.11.0"
26
+
27
+ if ENV['PRISM_VERSION'] == 'latest'
28
+ gem "prism", github: "ruby/prism"
29
+ elsif ENV['PRISM_VERSION']
30
+ gem "prism", ENV['PRISM_VERSION']
31
+ else
32
+ gem "prism", "!= 1.8.0"
33
+ end
24
34
 
25
35
  if RUBY_VERSION >= "3.0.0" && !is_truffleruby
26
36
  gem "repl_type_completor"
data/README.md CHANGED
@@ -1,33 +1,14 @@
1
1
  # IRB
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/irb.svg)](https://badge.fury.io/rb/irb)
4
+ [![Static Badge](https://img.shields.io/badge/RDoc-flat?style=flat&label=documentation&link=https%3A%2F%2Fruby.github.io%2Firb%2F)](https://ruby.github.io/irb/)
4
5
  [![build](https://github.com/ruby/irb/actions/workflows/test.yml/badge.svg)](https://github.com/ruby/irb/actions/workflows/test.yml)
5
6
 
7
+
6
8
  IRB stands for "interactive Ruby" and is a tool to interactively execute Ruby expressions read from the standard input.
7
9
 
8
10
  The `irb` command from your shell will start the interpreter.
9
11
 
10
- - [Installation](#installation)
11
- - [Usage](#usage)
12
- - [The `irb` Executable](#the-irb-executable)
13
- - [The `binding.irb` Breakpoint](#the-bindingirb-breakpoint)
14
- - [Commands](#commands)
15
- - [Debugging with IRB](#debugging-with-irb)
16
- - [More about `debug.gem`](#more-about-debuggem)
17
- - [Advantages Over `debug.gem`'s Console](#advantages-over-debuggems-console)
18
- - [Type Based Completion](#type-based-completion)
19
- - [How to Enable IRB::TypeCompletor](#how-to-enable-irbtypecompletor)
20
- - [Advantage over Default IRB::RegexpCompletor](#advantage-over-default-irbregexpcompletor)
21
- - [Difference between Steep's Completion](#difference-between-steeps-completion)
22
- - [Configuration](#configuration)
23
- - [Environment Variables](#environment-variables)
24
- - [Documentation](#documentation)
25
- - [Extending IRB](#extending-irb)
26
- - [Development](#development)
27
- - [Contributing](#contributing)
28
- - [Releasing](#releasing)
29
- - [License](#license)
30
-
31
12
  ## Installation
32
13
 
33
14
  > [!Note]
@@ -58,7 +39,7 @@ $ gem install irb
58
39
 
59
40
  > [!Note]
60
41
  >
61
- > We're working hard to match Pry's variety of powerful features in IRB, and you can track our progress or find contribution ideas in [this document](https://github.com/ruby/irb/blob/master/COMPARED_WITH_PRY.md).
42
+ > We're working hard to match Pry's variety of powerful features in IRB, and you can track our progress or find contribution ideas in [this document](https://ruby.github.io/irb/COMPARED_WITH_PRY_md.html).
62
43
 
63
44
  ### The `irb` Executable
64
45
 
@@ -105,293 +86,32 @@ irb(main):002:0> exit
105
86
  Hello World
106
87
  ```
107
88
 
108
- ## Commands
109
-
110
- The following commands are available on IRB. You can get the same output from the `help` command.
111
-
112
- ```txt
113
- Help
114
- help List all available commands. Use `help <command>` to get information about a specific command.
115
-
116
- IRB
117
- exit Exit the current irb session.
118
- exit! Exit the current process.
119
- irb_load Load a Ruby file.
120
- irb_require Require a Ruby file.
121
- source Loads a given file in the current session.
122
- irb_info Show information about IRB.
123
- history Shows the input history. `-g [query]` or `-G [query]` allows you to filter the output.
124
-
125
- Workspace
126
- cwws Show the current workspace.
127
- chws Change the current workspace to an object.
128
- workspaces Show workspaces.
129
- pushws Push an object to the workspace stack.
130
- popws Pop a workspace from the workspace stack.
131
-
132
- Multi-irb (DEPRECATED)
133
- irb Start a child IRB.
134
- jobs List of current sessions.
135
- fg Switches to the session of the given number.
136
- kill Kills the session with the given number.
137
-
138
- Debugging
139
- debug Start the debugger of debug.gem.
140
- break Start the debugger of debug.gem and run its `break` command.
141
- catch Start the debugger of debug.gem and run its `catch` command.
142
- next Start the debugger of debug.gem and run its `next` command.
143
- delete Start the debugger of debug.gem and run its `delete` command.
144
- step Start the debugger of debug.gem and run its `step` command.
145
- continue Start the debugger of debug.gem and run its `continue` command.
146
- finish Start the debugger of debug.gem and run its `finish` command.
147
- backtrace Start the debugger of debug.gem and run its `backtrace` command.
148
- info Start the debugger of debug.gem and run its `info` command.
149
-
150
- Misc
151
- edit Open a file or source location.
152
- measure `measure` enables the mode to measure processing time. `measure :off` disables it.
153
-
154
- Context
155
- show_doc Enter the mode to look up RI documents.
156
- ls Show methods, constants, and variables.
157
- show_source Show the source code of a given method or constant.
158
- whereami Show the source code around binding.irb again.
159
-
160
- Aliases
161
- $ Alias for `show_source`
162
- @ Alias for `whereami`
163
- ```
164
-
165
- ## Debugging with IRB
166
-
167
- Starting from version 1.8.0, IRB boasts a powerful integration with `debug.gem`, providing a debugging experience akin to `pry-byebug`.
168
-
169
- After hitting a `binding.irb` breakpoint, you can activate the debugger with the `debug` command. Alternatively, if the `debug` method happens to already be defined in the current scope, you can call `irb_debug`.
170
-
171
- ```shell
172
- From: test.rb @ line 3 :
173
-
174
- 1:
175
- 2: def greet(word)
176
- => 3: binding.irb
177
- 4: puts "Hello #{word}"
178
- 5: end
179
- 6:
180
- 7: greet("World")
181
-
182
- irb(main):001> debug
183
- irb:rdbg(main):002>
184
- ```
185
-
186
- Once activated, the prompt's header changes from `irb` to `irb:rdbg`, enabling you to use any of `debug.gem`'s [commands](https://github.com/ruby/debug#debug-command-on-the-debug-console):
187
-
188
- ```shell
189
- irb:rdbg(main):002> info # use info command to see available variables
190
- %self = main
191
- _ = nil
192
- word = "World"
193
- irb:rdbg(main):003> next # use next command to move to the next line
194
- [1, 7] in test.rb
195
- 1|
196
- 2| def greet(word)
197
- 3| binding.irb
198
- => 4| puts "Hello #{word}"
199
- 5| end
200
- 6|
201
- 7| greet("World")
202
- =>#0 Object#greet(word="World") at test.rb:4
203
- #1 <main> at test.rb:7
204
- irb:rdbg(main):004>
205
- ```
206
-
207
- Simultaneously, you maintain access to IRB's commands, such as `show_source`:
208
-
209
- ```shell
210
- irb:rdbg(main):004> show_source greet
211
-
212
- From: test.rb:2
213
-
214
- def greet(word)
215
- binding.irb
216
- puts "Hello #{word}"
217
- end
218
- ```
219
-
220
- ### More about `debug.gem`
221
-
222
- `debug.gem` offers many advanced debugging features that simple REPLs can't provide, including:
223
-
224
- - Step-debugging
225
- - Frame navigation
226
- - Setting breakpoints with commands
227
- - Thread control
228
- - ...and many more
229
-
230
- To learn about these features, please refer to `debug.gem`'s [commands list](https://github.com/ruby/debug#debug-command-on-the-debug-console).
231
-
232
- In the `irb:rdbg` session, the `help` command will also display all commands from `debug.gem`.
233
-
234
- ### Advantages Over `debug.gem`'s Console
235
-
236
- This integration offers several benefits over `debug.gem`'s native console:
237
-
238
- 1. Access to handy IRB commands like `show_source` or `show_doc`.
239
- 2. Support for multi-line input.
240
- 3. Symbol shortcuts such as `@` (`whereami`) and `$` (`show_source`).
241
- 4. Autocompletion.
242
- 5. Customizable prompt.
243
-
244
- However, there are also some limitations to be aware of:
245
-
246
- 1. `binding.irb` doesn't support `pre` and `do` arguments like [`binding.break`](https://github.com/ruby/debug#bindingbreak-method).
247
- 2. As IRB [doesn't currently support remote-connection](https://github.com/ruby/irb/issues/672), it can't be used with `debug.gem`'s remote debugging feature.
248
- 3. Access to the previous return value via the underscore `_` is not supported.
249
-
250
- ## Type Based Completion
251
-
252
- IRB's default completion `IRB::RegexpCompletor` uses Regexp. IRB has another experimental completion `IRB::TypeCompletor` that uses type analysis.
253
-
254
- ### How to Enable IRB::TypeCompletor
255
-
256
- Install [ruby/repl_type_completor](https://github.com/ruby/repl_type_completor/) with:
257
- ```
258
- $ gem install repl_type_completor
259
- ```
260
- Or add these lines to your project's Gemfile.
261
- ```ruby
262
- gem 'irb'
263
- gem 'repl_type_completor', group: [:development, :test]
264
- ```
265
-
266
- Now you can use type based completion by:
267
-
268
- Running IRB with the `--type-completor` option
269
- ```
270
- $ irb --type-completor
271
- ```
272
-
273
- Or writing this line to IRB's rc-file (e.g. `~/.irbrc`)
274
- ```ruby
275
- IRB.conf[:COMPLETOR] = :type # default is :regexp
276
- ```
277
-
278
- Or setting the environment variable `IRB_COMPLETOR`
279
- ```ruby
280
- ENV['IRB_COMPLETOR'] = 'type'
281
- IRB.start
282
- ```
283
-
284
- To check if it's enabled, type `irb_info` into IRB and see the `Completion` section.
285
- ```
286
- irb(main):001> irb_info
287
- ...
288
- # Enabled
289
- Completion: Autocomplete, ReplTypeCompletor: 0.1.0, Prism: 0.18.0, RBS: 3.3.0
290
- # Not enabled
291
- Completion: Autocomplete, RegexpCompletor
292
- ...
293
- ```
294
- If you have `sig/` directory or `rbs_collection.lock.yaml` in current directory, IRB will load it.
295
-
296
- ### Advantage over Default IRB::RegexpCompletor
297
-
298
- IRB::TypeCompletor can autocomplete chained methods, block parameters and more if type information is available.
299
- These are some examples IRB::RegexpCompletor cannot complete.
300
-
301
- ```ruby
302
- irb(main):001> 'Ruby'.upcase.chars.s # Array methods (sample, select, shift, size)
303
- ```
89
+ ### Debugging
304
90
 
305
- ```ruby
306
- irb(main):001> 10.times.map(&:to_s).each do |s|
307
- irb(main):002> s.up # String methods (upcase, upcase!, upto)
308
- ```
91
+ You can use IRB as a debugging console with `debug.gem` with these options:
309
92
 
310
- ```ruby
311
- irb(main):001> class User < ApplicationRecord
312
- irb(main):002> def foo
313
- irb(main):003> sa # save, save!
314
- ```
93
+ - In `binding.irb`, use the `debug` command to start an `irb:rdbg` session with access to all `debug.gem` commands.
94
+ - Use the `RUBY_DEBUG_IRB_CONSOLE=1` environment variable to make `debug.gem` use IRB as the debugging console.
315
95
 
316
- As a trade-off, completion calculation takes more time than IRB::RegexpCompletor.
96
+ To learn more about debugging with IRB, see [Debugging with IRB](https://ruby.github.io/irb/#label-Debugging+with+IRB).
317
97
 
318
- ### Difference between Steep's Completion
319
-
320
- Compared with Steep, IRB::TypeCompletor has some difference and limitations.
321
- ```ruby
322
- [0, 'a'].sample.
323
- # Steep completes intersection of Integer methods and String methods
324
- # IRB::TypeCompletor completes both Integer and String methods
325
- ```
326
-
327
- Some features like type narrowing is not implemented.
328
- ```ruby
329
- def f(arg = [0, 'a'].sample)
330
- if arg.is_a?(String)
331
- arg. # Completes both Integer and String methods
332
- ```
98
+ ## Documentation
333
99
 
334
- Unlike other static type checker, IRB::TypeCompletor uses runtime information to provide better completion.
335
- ```ruby
336
- irb(main):001> a = [1]
337
- => [1]
338
- irb(main):002> a.first. # Completes Integer methods
339
- ```
100
+ https://ruby.github.io/irb/ provides a comprehensive guide to IRB's features and usage.
340
101
 
341
102
  ## Configuration
342
103
 
343
- ### Environment Variables
344
-
345
- - `NO_COLOR`: Assigning a value to it disables IRB's colorization.
346
- - `IRB_USE_AUTOCOMPLETE`: Setting it to `false` disables IRB's autocompletion.
347
- - `IRB_COMPLETOR`: Configures IRB's auto-completion behavior, allowing settings for either `regexp` or `type`.
348
- - `VISUAL`: Its value would be used to open files by the `edit` command.
349
- - `EDITOR`: Its value would be used to open files by the `edit` command if `VISUAL` is unset.
350
- - `IRBRC`: The file specified would be evaluated as IRB's rc-file.
351
-
352
- ## Documentation
353
-
354
- https://ruby.github.io/irb/
104
+ See the [Configuration page](https://ruby.github.io/irb/Configurations_md.html) in the documentation.
355
105
 
356
106
  ## Extending IRB
357
107
 
358
108
  IRB `v1.13.0` and later versions allows users/libraries to extend its functionality through official APIs.
359
109
 
360
- For more information, please visit [EXTEND_IRB.md](./EXTEND_IRB.md).
361
-
362
- ## Development
363
-
364
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
365
-
366
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
110
+ For more information, please visit the [IRB Extension Guide](https://ruby.github.io/irb/EXTEND_IRB_md.html).
367
111
 
368
112
  ## Contributing
369
113
 
370
- Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/irb.
371
-
372
- ### Set up the environment
373
-
374
- 1. Fork the project to your GithHub account
375
- 2. Clone the fork with `git clone git@github.com:[your_username]/irb.git`
376
- 3. Run `bundle install`
377
- 4. Run `bundle exec rake` to make sure tests pass locally
378
-
379
- ### Run integration tests
380
-
381
- If your changes affect component rendering, such as the autocompletion's dialog/dropdown, you may need to run IRB's integration tests, known as `yamatanooroti`.
382
-
383
- Before running these tests, ensure that you have `libvterm` installed. If you're using Homebrew, you can install it by running:
384
-
385
- ```bash
386
- brew install libvterm
387
- ```
388
-
389
- After installing `libvterm`, you can run the integration tests using the following commands:
390
-
391
- ```bash
392
- WITH_VTERM=1 bundle install
393
- WITH_VTERM=1 bundle exec rake test test_yamatanooroti
394
- ```
114
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for more information.
395
115
 
396
116
  ## Releasing
397
117
 
@@ -0,0 +1,69 @@
1
+ # Index of Command-Line Options
2
+
3
+ These are the IRB command-line options, with links to explanatory text:
4
+
5
+ - `-d`: Set `$DEBUG` and {$VERBOSE}[rdoc-ref:IRB@Verbosity]
6
+ to `true`.
7
+ - `-E _ex_[:_in_]`: Set initial external (ex) and internal (in)
8
+ {encodings}[rdoc-ref:IRB@Encodings] (same as `ruby -E`).
9
+ - `-f`: Don't initialize from {configuration file}[rdoc-ref:IRB@Configuration+File].
10
+ - `-I _dirpath_`: Specify {$LOAD_PATH directory}[rdoc-ref:IRB@Load+Modules]
11
+ (same as `ruby -I`).
12
+ - `-r _load-module_`: Require {load-module}[rdoc-ref:IRB@Load+Modules]
13
+ (same as `ruby -r`).
14
+ - `-U`: Set external and internal {encodings}[rdoc-ref:IRB@Encodings] to UTF-8.
15
+ - `-w`: Suppress {warnings}[rdoc-ref:IRB@Warnings] (same as `ruby -w`).
16
+ - `-W[_level_]`: Set {warning level}[rdoc-ref:IRB@Warnings];
17
+ 0=silence, 1=medium, 2=verbose (same as `ruby -W`).
18
+ - `--autocomplete`: Use {auto-completion}[rdoc-ref:IRB@Automatic+Completion].
19
+ - `--back-trace-limit _n_`: Set a {backtrace limit}[rdoc-ref:IRB@Tracer];
20
+ display at most the top `n` and bottom `n` entries.
21
+ - `--colorize`: Use {color-highlighting}[rdoc-ref:IRB@Color+Highlighting]
22
+ for input and output.
23
+ - `--context-mode _n_`: Select method to create Binding object
24
+ for new {workspace}[rdoc-ref:IRB@Commands]; `n` in range `0..5`.
25
+ - `--echo`: Print ({echo}[rdoc-ref:IRB@Return-Value+Printing+-28Echoing-29])
26
+ return values.
27
+ - `--extra-doc-dir _dirpath_`:
28
+ Add a {documentation directory}[rdoc-ref:IRB@RI+Documentation+Directories]
29
+ for the documentation dialog.
30
+ - `--inf-ruby-mode`: Set prompt mode to {:INF_RUBY}[rdoc-ref:IRB@Pre-Defined+Prompts]
31
+ (appropriate for `inf-ruby-mode` on Emacs);
32
+ suppresses --multiline and --singleline.
33
+ - `--inspect`: Use method `inspect` for printing ({echoing}[rdoc-ref:IRB@Return-Value+Printing+-28Echoing-29])
34
+ return values.
35
+ - `--multiline`: Use the multiline editor as the {input method}[rdoc-ref:IRB@Input+Method].
36
+ - `--noautocomplete`: Don't use {auto-completion}[rdoc-ref:IRB@Automatic+Completion].
37
+ - `--nocolorize`: Don't use {color-highlighting}[rdoc-ref:IRB@Color+Highlighting]
38
+ for input and output.
39
+ - `--noecho`: Don't print ({echo}[rdoc-ref:IRB@Return-Value+Printing+-28Echoing-29])
40
+ return values.
41
+ - `--noecho-on-assignment`: Don't print ({echo}[rdoc-ref:IRB@Return-Value+Printing+-28Echoing-29])
42
+ result on assignment.
43
+ - `--noinspect`: Don't se method `inspect` for printing ({echoing}[rdoc-ref:IRB@Return-Value+Printing+-28Echoing-29])
44
+ return values.
45
+ - `--nomultiline`: Don't use the multiline editor as the {input method}[rdoc-ref:IRB@Input+Method].
46
+ - `--noprompt`: Don't print {prompts}[rdoc-ref:IRB@Prompt+and+Return+Formats].
47
+ - `--noscript`: Treat the first command-line argument as a normal
48
+ {command-line argument}[rdoc-ref:IRB@Initialization+Script],
49
+ and include it in `ARGV`.
50
+ - `--nosingleline`: Don't use the singleline editor as the {input method}[rdoc-ref:IRB@Input+Method].
51
+ - `--noverbose`: Don't print {verbose}[rdoc-ref:IRB@Verbosity] details.
52
+ - `--prompt _mode_`, `--prompt-mode _mode_`:
53
+ Set {prompt and return formats}[rdoc-ref:IRB@Prompt+and+Return+Formats];
54
+ `mode` may be a {pre-defined prompt}[rdoc-ref:IRB@Pre-Defined+Prompts]
55
+ or the name of a {custom prompt}[rdoc-ref:IRB@Custom+Prompts].
56
+ - `--script`: Treat the first command-line argument as the path to an
57
+ {initialization script}[rdoc-ref:IRB@Initialization+Script],
58
+ and omit it from `ARGV`.
59
+ - `--simple-prompt`, `--sample-book-mode`:
60
+ Set prompt mode to {:SIMPLE}[rdoc-ref:IRB@Pre-Defined+Prompts].
61
+ - `--singleline`: Use the singleline editor as the {input method}[rdoc-ref:IRB@Input+Method].
62
+ - `--tracer`: Use {Tracer}[rdoc-ref:IRB@Tracer] to print a stack trace for each input command.
63
+ - `--truncate-echo-on-assignment`: Print ({echo}[rdoc-ref:IRB@Return-Value+Printing+-28Echoing-29])
64
+ truncated result on assignment.
65
+ - `--verbose`Print {verbose}[rdoc-ref:IRB@Verbosity] details.
66
+ - `-v`, `--version`: Print the {IRB version}[rdoc-ref:IRB@Version].
67
+ - `-h`, `--help`: Print the {IRB help text}[rdoc-ref:IRB@Help].
68
+ - `--`: Separate options from {arguments}[rdoc-ref:IRB@Command-Line+Arguments]
69
+ on the command-line.
@@ -0,0 +1,22 @@
1
+ # Comparison with Pry
2
+
3
+ 👋 IRB is on a mission to match feature parity with Pry. This document is here to help us track the similarities and differences between the two.
4
+
5
+ Feel free to chip in and update this table - we appreciate your help!
6
+
7
+ | Feature | Pry | IRB | Note |
8
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
9
+ | Supported Rubies | `>= 2.0` | `>= 2.7` | |
10
+ | Source code browsing | `show-source` | `show_source` | IRB's `show_source` can't display C source. See [#664](https://github.com/ruby/irb/issues/664) |
11
+ | Document browsing | `ri` | `show_doc` | |
12
+ | Live help system | `help` or `command_name --help` | `help` | IRB doesn't support detailed descriptions for individual commands yet |
13
+ | Open methods in editors | `edit` | `edit` | |
14
+ | Syntax highlighting | Yes | Yes | |
15
+ | Command shell integration | Yes | No | Currently, there's no plan to support such features in IRB |
16
+ | Navigation | - `cd object` to enter `object` <br/> - `cd ..` to leave the current object <br/> - `nesting` to list nesting levels | - `pushws object` <br/> - `popws` <br/> - `workspaces` <br /> - `cd object`/`cd ..` (since [1.14.0](https://github.com/ruby/irb/releases/tag/v1.14.0)) | We plan to refine IRB's commands in the future |
17
+ | Runtime invocation | `binding.pry` | `binding.irb` | |
18
+ | Command system | Yes | No | Planned in #513 and #588 |
19
+ | Input history | [Comprehensive support](https://github.com/pry/pry/wiki/History) | Supports retrieving previous input and the `history` command | The history command doesn't support as many flags yet, but contributions are welcome. |
20
+ | Pager support | Command output and return value | Command output and return value | |
21
+ | Debugger integration | With `byebug` through [pry-byebug](https://github.com/deivid-rodriguez/pry-byebug) gem | Supports [`irb:rdbg`](https://github.com/ruby/irb#debugging-with-irb) sessions | |
22
+ | Rails console | Through [`pry-rails`](https://github.com/pry/pry-rails) gem | Rails' default | Rails console with IRB doesn't have commands like `show-routes` or `show-models` |