irb 1.11.1 → 1.12.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.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/README.md +11 -9
- data/Rakefile +1 -1
- data/lib/irb/cmd/nop.rb +3 -52
- data/lib/irb/{cmd → command}/backtrace.rb +1 -1
- data/lib/irb/command/base.rb +64 -0
- data/lib/irb/{cmd → command}/break.rb +1 -1
- data/lib/irb/{cmd → command}/catch.rb +1 -1
- data/lib/irb/{cmd → command}/chws.rb +4 -6
- data/lib/irb/{cmd → command}/continue.rb +1 -1
- data/lib/irb/{cmd → command}/debug.rb +3 -4
- data/lib/irb/{cmd → command}/delete.rb +1 -1
- data/lib/irb/command/edit.rb +70 -0
- data/lib/irb/{cmd → command}/exit.rb +2 -4
- data/lib/irb/{cmd → command}/finish.rb +1 -1
- data/lib/irb/command/force_exit.rb +20 -0
- data/lib/irb/command/help.rb +84 -0
- data/lib/irb/{cmd → command}/history.rb +3 -3
- data/lib/irb/{cmd → command}/info.rb +1 -1
- data/lib/irb/{cmd → command}/irb_info.rb +5 -6
- data/lib/irb/{cmd → command}/load.rb +3 -5
- data/lib/irb/{cmd → command}/ls.rb +10 -4
- data/lib/irb/{cmd → command}/measure.rb +2 -4
- data/lib/irb/{cmd → command}/next.rb +1 -1
- data/lib/irb/{cmd → command}/pushws.rb +20 -5
- data/lib/irb/{cmd → command}/show_doc.rb +17 -5
- data/lib/irb/{cmd → command}/show_source.rb +26 -10
- data/lib/irb/{cmd → command}/step.rb +1 -1
- data/lib/irb/{cmd → command}/subirb.rb +3 -5
- data/lib/irb/{cmd → command}/whereami.rb +2 -4
- data/lib/irb/{extend-command.rb → command.rb} +50 -86
- data/lib/irb/completion.rb +1 -1
- data/lib/irb/context.rb +63 -20
- data/lib/irb/ext/change-ws.rb +4 -4
- data/lib/irb/ext/eval_history.rb +3 -3
- data/lib/irb/ext/loader.rb +4 -4
- data/lib/irb/ext/multi-irb.rb +1 -1
- data/lib/irb/ext/tracer.rb +12 -51
- data/lib/irb/ext/use-loader.rb +6 -8
- data/lib/irb/ext/workspaces.rb +11 -34
- data/lib/irb/frame.rb +1 -1
- data/lib/irb/help.rb +1 -1
- data/lib/irb/history.rb +12 -4
- data/lib/irb/init.rb +28 -17
- data/lib/irb/input-method.rb +18 -2
- data/lib/irb/inspector.rb +3 -3
- data/lib/irb/lc/error.rb +1 -6
- data/lib/irb/lc/ja/error.rb +1 -6
- data/lib/irb/locale.rb +2 -2
- data/lib/irb/nesting_parser.rb +13 -3
- data/lib/irb/notifier.rb +1 -1
- data/lib/irb/output-method.rb +2 -8
- data/lib/irb/ruby-lex.rb +2 -2
- data/lib/irb/source_finder.rb +98 -38
- data/lib/irb/statement.rb +25 -3
- data/lib/irb/version.rb +3 -3
- data/lib/irb/workspace.rb +4 -4
- data/lib/irb/ws-for-case-2.rb +1 -1
- data/lib/irb/xmp.rb +1 -1
- data/lib/irb.rb +38 -32
- metadata +30 -29
- data/lib/irb/cmd/edit.rb +0 -60
- data/lib/irb/cmd/help.rb +0 -23
- data/lib/irb/cmd/show_cmds.rb +0 -59
data/lib/irb/cmd/show_cmds.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "stringio"
|
4
|
-
require_relative "nop"
|
5
|
-
require_relative "../pager"
|
6
|
-
|
7
|
-
module IRB
|
8
|
-
# :stopdoc:
|
9
|
-
|
10
|
-
module ExtendCommand
|
11
|
-
class ShowCmds < Nop
|
12
|
-
category "IRB"
|
13
|
-
description "List all available commands and their description."
|
14
|
-
|
15
|
-
def execute(*args)
|
16
|
-
commands_info = IRB::ExtendCommandBundle.all_commands_info
|
17
|
-
commands_grouped_by_categories = commands_info.group_by { |cmd| cmd[:category] }
|
18
|
-
|
19
|
-
user_aliases = irb_context.instance_variable_get(:@user_aliases)
|
20
|
-
|
21
|
-
commands_grouped_by_categories["Aliases"] = user_aliases.map do |alias_name, target|
|
22
|
-
{ display_name: alias_name, description: "Alias for `#{target}`" }
|
23
|
-
end
|
24
|
-
|
25
|
-
if irb_context.with_debugger
|
26
|
-
# Remove the original "Debugging" category
|
27
|
-
commands_grouped_by_categories.delete("Debugging")
|
28
|
-
# Remove the `help` command as it's delegated to the debugger
|
29
|
-
commands_grouped_by_categories["Context"].delete_if { |cmd| cmd[:display_name] == :help }
|
30
|
-
# Add an empty "Debugging (from debug.gem)" category at the end
|
31
|
-
commands_grouped_by_categories["Debugging (from debug.gem)"] = []
|
32
|
-
end
|
33
|
-
|
34
|
-
longest_cmd_name_length = commands_info.map { |c| c[:display_name].length }.max
|
35
|
-
|
36
|
-
output = StringIO.new
|
37
|
-
|
38
|
-
commands_grouped_by_categories.each do |category, cmds|
|
39
|
-
output.puts Color.colorize(category, [:BOLD])
|
40
|
-
|
41
|
-
cmds.each do |cmd|
|
42
|
-
output.puts " #{cmd[:display_name].to_s.ljust(longest_cmd_name_length)} #{cmd[:description]}"
|
43
|
-
end
|
44
|
-
|
45
|
-
output.puts
|
46
|
-
end
|
47
|
-
|
48
|
-
# Append the debugger help at the end
|
49
|
-
if irb_context.with_debugger
|
50
|
-
output.puts DEBUGGER__.help
|
51
|
-
end
|
52
|
-
|
53
|
-
Pager.page_content(output.string)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# :startdoc:
|
59
|
-
end
|