irb 1.11.1 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/README.md +11 -9
  4. data/Rakefile +1 -1
  5. data/lib/irb/cmd/nop.rb +3 -52
  6. data/lib/irb/{cmd → command}/backtrace.rb +1 -1
  7. data/lib/irb/command/base.rb +64 -0
  8. data/lib/irb/{cmd → command}/break.rb +1 -1
  9. data/lib/irb/{cmd → command}/catch.rb +1 -1
  10. data/lib/irb/{cmd → command}/chws.rb +4 -6
  11. data/lib/irb/{cmd → command}/continue.rb +1 -1
  12. data/lib/irb/{cmd → command}/debug.rb +3 -4
  13. data/lib/irb/{cmd → command}/delete.rb +1 -1
  14. data/lib/irb/command/edit.rb +70 -0
  15. data/lib/irb/{cmd → command}/exit.rb +2 -4
  16. data/lib/irb/{cmd → command}/finish.rb +1 -1
  17. data/lib/irb/command/force_exit.rb +20 -0
  18. data/lib/irb/command/help.rb +84 -0
  19. data/lib/irb/{cmd → command}/history.rb +3 -3
  20. data/lib/irb/{cmd → command}/info.rb +1 -1
  21. data/lib/irb/{cmd → command}/irb_info.rb +5 -6
  22. data/lib/irb/{cmd → command}/load.rb +3 -5
  23. data/lib/irb/{cmd → command}/ls.rb +10 -4
  24. data/lib/irb/{cmd → command}/measure.rb +2 -4
  25. data/lib/irb/{cmd → command}/next.rb +1 -1
  26. data/lib/irb/{cmd → command}/pushws.rb +20 -5
  27. data/lib/irb/{cmd → command}/show_doc.rb +17 -5
  28. data/lib/irb/{cmd → command}/show_source.rb +26 -10
  29. data/lib/irb/{cmd → command}/step.rb +1 -1
  30. data/lib/irb/{cmd → command}/subirb.rb +3 -5
  31. data/lib/irb/{cmd → command}/whereami.rb +2 -4
  32. data/lib/irb/{extend-command.rb → command.rb} +50 -86
  33. data/lib/irb/completion.rb +1 -1
  34. data/lib/irb/context.rb +63 -20
  35. data/lib/irb/ext/change-ws.rb +4 -4
  36. data/lib/irb/ext/eval_history.rb +3 -3
  37. data/lib/irb/ext/loader.rb +4 -4
  38. data/lib/irb/ext/multi-irb.rb +1 -1
  39. data/lib/irb/ext/tracer.rb +12 -51
  40. data/lib/irb/ext/use-loader.rb +6 -8
  41. data/lib/irb/ext/workspaces.rb +11 -34
  42. data/lib/irb/frame.rb +1 -1
  43. data/lib/irb/help.rb +1 -1
  44. data/lib/irb/history.rb +12 -4
  45. data/lib/irb/init.rb +28 -17
  46. data/lib/irb/input-method.rb +18 -2
  47. data/lib/irb/inspector.rb +3 -3
  48. data/lib/irb/lc/error.rb +1 -6
  49. data/lib/irb/lc/ja/error.rb +1 -6
  50. data/lib/irb/locale.rb +2 -2
  51. data/lib/irb/nesting_parser.rb +13 -3
  52. data/lib/irb/notifier.rb +1 -1
  53. data/lib/irb/output-method.rb +2 -8
  54. data/lib/irb/ruby-lex.rb +2 -2
  55. data/lib/irb/source_finder.rb +98 -38
  56. data/lib/irb/statement.rb +25 -3
  57. data/lib/irb/version.rb +3 -3
  58. data/lib/irb/workspace.rb +4 -4
  59. data/lib/irb/ws-for-case-2.rb +1 -1
  60. data/lib/irb/xmp.rb +1 -1
  61. data/lib/irb.rb +38 -32
  62. metadata +30 -29
  63. data/lib/irb/cmd/edit.rb +0 -60
  64. data/lib/irb/cmd/help.rb +0 -23
  65. data/lib/irb/cmd/show_cmds.rb +0 -59
@@ -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