Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document a full list of commands #451

Merged
merged 3 commits into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,48 @@ irb(main):006:1> end

The Readline extension module can be used with irb. Use of Readline is default if it's installed.

## Commands
k0kubun marked this conversation as resolved.
Show resolved Hide resolved

The following commands are available on IRB.

* `cwws`
* Show the current workspace.
* `cb`, `cws`, `chws`
* Change the current workspace to an object.
* `bindings`, `workspaces`
* Show workspaces.
* `pushb`, `pushws`
* Push an object to the workspace stack.
* `popb`, `popws`
* Pop a workspace from the workspace stack.
* `load`
* Load a Ruby file.
* `require`
* Require a Ruby file.
* `source`
* Loads a given file in the current session.
* `irb`
* Start a child IRB.
* `jobs`
* List of current sessions.
* `fg`
* Switches to the session of the given number.
* `kill`
* Kills the session with the given number.
* `help`
* Enter the mode to look up RI documents.
* `irb_info`
* Show information about IRB.
* `ls`
* Show methods, constants, and variables.
`-g [query]` or `-G [query]` allows you to filter out the output.
* `measure`
* `measure` enables the mode to measure processing time. `measure :off` disables it.
* `$`, `show_source`
* Show the source code of a given method or constant.
* `@`, `whereami`
* Show the source code around binding.irb again.

## Documentation

https://docs.ruby-lang.org/en/master/IRB.html
Expand Down
42 changes: 42 additions & 0 deletions lib/irb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,48 @@
#
# :include: ./irb/lc/help-message
#
# == Commands
#
# The following commands are available on IRB.
#
# * cwws
# * Show the current workspace.
# * cb, cws, chws
# * Change the current workspace to an object.
# * bindings, workspaces
# * Show workspaces.
# * pushb, pushws
# * Push an object to the workspace stack.
# * popb, popws
# * Pop a workspace from the workspace stack.
# * load
# * Load a Ruby file.
# * require
# * Require a Ruby file.
# * source
# * Loads a given file in the current session.
# * irb
# * Start a child IRB.
# * jobs
# * List of current sessions.
# * fg
# * Switches to the session of the given number.
# * kill
# * Kills the session with the given number.
# * help
# * Enter the mode to look up RI documents.
# * irb_info
# * Show information about IRB.
# * ls
# * Show methods, constants, and variables.
# -g [query] or -G [query] allows you to filter out the output.
# * measure
# * measure enables the mode to measure processing time. measure :off disables it.
# * $, show_source
# * Show the source code of a given method or constant.
# * @, whereami
# * Show the source code around binding.irb again.
#
# == Configuration
#
# IRB reads a personal initialization file when it's invoked.
Expand Down