Skip to content

Commit 5958c30

Browse files
k0kubunmatzbot
authored andcommitted
[ruby/irb] Document a full list of commands
(ruby/irb#451) * Document a full list of commands * Document debug as well * Make it less duplicated
1 parent 23750c8 commit 5958c30

File tree

3 files changed

+89
-20
lines changed

3 files changed

+89
-20
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,50 @@ see [Building Ruby](doc/contributing/building_ruby.md)
5454

5555
https://www.ruby-lang.org/
5656

57+
## Commands
58+
59+
The following commands are available on IRB.
60+
61+
* `cwws`
62+
* Show the current workspace.
63+
* `cb`, `cws`, `chws`
64+
* Change the current workspace to an object.
65+
* `bindings`, `workspaces`
66+
* Show workspaces.
67+
* `pushb`, `pushws`
68+
* Push an object to the workspace stack.
69+
* `popb`, `popws`
70+
* Pop a workspace from the workspace stack.
71+
* `load`
72+
* Load a Ruby file.
73+
* `require`
74+
* Require a Ruby file.
75+
* `source`
76+
* Loads a given file in the current session.
77+
* `irb`
78+
* Start a child IRB.
79+
* `jobs`
80+
* List of current sessions.
81+
* `fg`
82+
* Switches to the session of the given number.
83+
* `kill`
84+
* Kills the session with the given number.
85+
* `help`
86+
* Enter the mode to look up RI documents.
87+
* `irb_info`
88+
* Show information about IRB.
89+
* `ls`
90+
* Show methods, constants, and variables.
91+
`-g [query]` or `-G [query]` allows you to filter out the output.
92+
* `measure`
93+
* `measure` enables the mode to measure processing time. `measure :off` disables it.
94+
* `$`, `show_source`
95+
* Show the source code of a given method or constant.
96+
* `@`, `whereami`
97+
* Show the source code around binding.irb again.
98+
* `debug`
99+
* Start the debugger of debug.gem.
100+
57101
## Documentation
58102

59103
- [English](https://docs.ruby-lang.org/en/master/index.html)

lib/irb.rb

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,50 @@
5353
#
5454
# :include: ./irb/lc/help-message
5555
#
56+
# == Commands
57+
#
58+
# The following commands are available on IRB.
59+
#
60+
# * cwws
61+
# * Show the current workspace.
62+
# * cb, cws, chws
63+
# * Change the current workspace to an object.
64+
# * bindings, workspaces
65+
# * Show workspaces.
66+
# * pushb, pushws
67+
# * Push an object to the workspace stack.
68+
# * popb, popws
69+
# * Pop a workspace from the workspace stack.
70+
# * load
71+
# * Load a Ruby file.
72+
# * require
73+
# * Require a Ruby file.
74+
# * source
75+
# * Loads a given file in the current session.
76+
# * irb
77+
# * Start a child IRB.
78+
# * jobs
79+
# * List of current sessions.
80+
# * fg
81+
# * Switches to the session of the given number.
82+
# * kill
83+
# * Kills the session with the given number.
84+
# * help
85+
# * Enter the mode to look up RI documents.
86+
# * irb_info
87+
# * Show information about IRB.
88+
# * ls
89+
# * Show methods, constants, and variables.
90+
# -g [query] or -G [query] allows you to filter out the output.
91+
# * measure
92+
# * measure enables the mode to measure processing time. measure :off disables it.
93+
# * $, show_source
94+
# * Show the source code of a given method or constant.
95+
# * @, whereami
96+
# * Show the source code around binding.irb again.
97+
# * debug
98+
# * Start the debugger of debug.gem.
99+
#
56100
# == Configuration
57101
#
58102
# IRB reads a personal initialization file when it's invoked.

lib/irb/extend-command.rb

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,7 @@ def self.load_command(command)
165165
nil
166166
end
167167

168-
# Installs the default irb commands:
169-
#
170-
# +irb_current_working_workspace+:: Context#main
171-
# +irb_change_workspace+:: Context#change_workspace
172-
# +irb_workspaces+:: Context#workspaces
173-
# +irb_push_workspace+:: Context#push_workspace
174-
# +irb_pop_workspace+:: Context#pop_workspace
175-
# +irb_load+:: #irb_load
176-
# +irb_require+:: #irb_require
177-
# +irb_source+:: IrbLoader#source_file
178-
# +irb+:: IRB.irb
179-
# +irb_jobs+:: JobManager
180-
# +irb_fg+:: JobManager#switch
181-
# +irb_kill+:: JobManager#kill
182-
# +irb_help+:: IRB@Command+line+options
183-
# +irb_info+:: #inspect
184-
# +irb_ls+:: Output#dump
185-
# +irb_measure+:: IRB::unset_measure_callback
186-
# +irb_show_source+:: #find_source, #show_source
187-
# +irb_whereami+:: Workspace#code_around_binding
168+
# Installs the default irb commands.
188169
def self.install_extend_commands
189170
for args in @EXTEND_COMMANDS
190171
def_extend_command(*args)

0 commit comments

Comments
 (0)