зеркало из https://github.com/github/ruby.git
[ruby/irb] Document a full list of commands
(https://github.com/ruby/irb/pull/451) * Document a full list of commands * Document debug as well * Make it less duplicated
This commit is contained in:
Родитель
23750c866a
Коммит
5958c305e5
44
README.md
44
README.md
|
@ -54,6 +54,50 @@ see [Building Ruby](doc/contributing/building_ruby.md)
|
|||
|
||||
https://www.ruby-lang.org/
|
||||
|
||||
## 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.
|
||||
* `debug`
|
||||
* Start the debugger of debug.gem.
|
||||
|
||||
## Documentation
|
||||
|
||||
- [English](https://docs.ruby-lang.org/en/master/index.html)
|
||||
|
|
44
lib/irb.rb
44
lib/irb.rb
|
@ -53,6 +53,50 @@ require_relative "irb/easter-egg"
|
|||
#
|
||||
# :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.
|
||||
# * debug
|
||||
# * Start the debugger of debug.gem.
|
||||
#
|
||||
# == Configuration
|
||||
#
|
||||
# IRB reads a personal initialization file when it's invoked.
|
||||
|
|
|
@ -165,26 +165,7 @@ module IRB # :nodoc:
|
|||
nil
|
||||
end
|
||||
|
||||
# Installs the default irb commands:
|
||||
#
|
||||
# +irb_current_working_workspace+:: Context#main
|
||||
# +irb_change_workspace+:: Context#change_workspace
|
||||
# +irb_workspaces+:: Context#workspaces
|
||||
# +irb_push_workspace+:: Context#push_workspace
|
||||
# +irb_pop_workspace+:: Context#pop_workspace
|
||||
# +irb_load+:: #irb_load
|
||||
# +irb_require+:: #irb_require
|
||||
# +irb_source+:: IrbLoader#source_file
|
||||
# +irb+:: IRB.irb
|
||||
# +irb_jobs+:: JobManager
|
||||
# +irb_fg+:: JobManager#switch
|
||||
# +irb_kill+:: JobManager#kill
|
||||
# +irb_help+:: IRB@Command+line+options
|
||||
# +irb_info+:: #inspect
|
||||
# +irb_ls+:: Output#dump
|
||||
# +irb_measure+:: IRB::unset_measure_callback
|
||||
# +irb_show_source+:: #find_source, #show_source
|
||||
# +irb_whereami+:: Workspace#code_around_binding
|
||||
# Installs the default irb commands.
|
||||
def self.install_extend_commands
|
||||
for args in @EXTEND_COMMANDS
|
||||
def_extend_command(*args)
|
||||
|
|
Загрузка…
Ссылка в новой задаче