irb 1.3.6 → 1.4.1
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 -5
- data/Rakefile +10 -1
- data/doc/irb/irb.rd.ja +30 -14
- data/irb.gemspec +1 -1
- data/lib/irb/cmd/help.rb +2 -1
- data/lib/irb/cmd/info.rb +7 -0
- data/lib/irb/cmd/ls.rb +9 -15
- data/lib/irb/cmd/measure.rb +3 -0
- data/lib/irb/cmd/show_source.rb +11 -4
- data/lib/irb/completion.rb +57 -17
- data/lib/irb/context.rb +37 -9
- data/lib/irb/init.rb +9 -0
- data/lib/irb/input-method.rb +100 -1
- data/lib/irb/lc/help-message +10 -1
- data/lib/irb/lc/ja/help-message +2 -0
- data/lib/irb/ruby-lex.rb +151 -92
- data/lib/irb/version.rb +2 -2
- data/lib/irb/workspace.rb +3 -0
- data/lib/irb.rb +21 -6
- data/man/irb.1 +23 -1
- metadata +9 -9
data/lib/irb.rb
CHANGED
@@ -62,8 +62,15 @@ require_relative "irb/easter-egg"
|
|
62
62
|
# -W[level=2] Same as `ruby -W`
|
63
63
|
# --context-mode n Set n[0-4] to method to create Binding Object,
|
64
64
|
# when new workspace was created
|
65
|
-
# --
|
65
|
+
# --extra-doc-dir Add an extra doc dir for the doc dialog
|
66
|
+
# --echo Show result (default)
|
66
67
|
# --noecho Don't show result
|
68
|
+
# --echo-on-assignment
|
69
|
+
# Show result on assignment
|
70
|
+
# --noecho-on-assignment
|
71
|
+
# Don't show result on assignment
|
72
|
+
# --truncate-echo-on-assignment
|
73
|
+
# Show truncated result on assignment (default)
|
67
74
|
# --inspect Use `inspect' for output
|
68
75
|
# --noinspect Don't use inspect for output
|
69
76
|
# --multiline Use multiline editor module
|
@@ -72,6 +79,8 @@ require_relative "irb/easter-egg"
|
|
72
79
|
# --nosingleline Don't use singleline editor module
|
73
80
|
# --colorize Use colorization
|
74
81
|
# --nocolorize Don't use colorization
|
82
|
+
# --autocomplete Use autocompletion
|
83
|
+
# --noautocomplete Don't use autocompletion
|
75
84
|
# --prompt prompt-mode/--prompt-mode prompt-mode
|
76
85
|
# Switch prompt mode. Pre-defined prompt modes are
|
77
86
|
# `default', `simple', `xmp' and `inf-ruby'
|
@@ -114,6 +123,7 @@ require_relative "irb/easter-egg"
|
|
114
123
|
# IRB.conf[:USE_SINGLELINE] = nil
|
115
124
|
# IRB.conf[:USE_COLORIZE] = true
|
116
125
|
# IRB.conf[:USE_TRACER] = false
|
126
|
+
# IRB.conf[:USE_AUTOCOMPLETE] = true
|
117
127
|
# IRB.conf[:IGNORE_SIGINT] = true
|
118
128
|
# IRB.conf[:IGNORE_EOF] = false
|
119
129
|
# IRB.conf[:PROMPT_MODE] = :DEFAULT
|
@@ -524,7 +534,7 @@ module IRB
|
|
524
534
|
@context.io.prompt
|
525
535
|
end
|
526
536
|
|
527
|
-
@scanner.set_input(@context.io) do
|
537
|
+
@scanner.set_input(@context.io, context: @context) do
|
528
538
|
signal_status(:IN_INPUT) do
|
529
539
|
if l = @context.io.gets
|
530
540
|
print l if @context.verbose?
|
@@ -604,7 +614,7 @@ module IRB
|
|
604
614
|
ret = conv.primitive_convert(str, dst)
|
605
615
|
case ret
|
606
616
|
when :invalid_byte_sequence
|
607
|
-
conv.insert_output(
|
617
|
+
conv.insert_output(conv.primitive_errinfo[3].dump[1..-2])
|
608
618
|
redo
|
609
619
|
when :undefined_conversion
|
610
620
|
c = conv.primitive_errinfo[3].dup.force_encoding(conv.primitive_errinfo[1])
|
@@ -666,6 +676,8 @@ module IRB
|
|
666
676
|
lines = lines.reverse if order == :bottom
|
667
677
|
lines.map{ |l| l + "\n" }.join
|
668
678
|
}
|
679
|
+
# The "<top (required)>" in "(irb)" may be the top level of IRB so imitate the main object.
|
680
|
+
message = message.gsub(/\(irb\):(?<num>\d+):in `<(?<frame>top \(required\))>'/) { "(irb):#{$~[:num]}:in `<main>'" }
|
669
681
|
puts message
|
670
682
|
end
|
671
683
|
print "Maybe IRB bug!\n" if irb_bug
|
@@ -812,17 +824,20 @@ module IRB
|
|
812
824
|
diff_size = output_width - Reline::Unicode.calculate_width(first_line, true)
|
813
825
|
if diff_size.positive? and output_width > winwidth
|
814
826
|
lines, _ = Reline::Unicode.split_by_width(first_line, winwidth - diff_size - 3)
|
815
|
-
str = "%s
|
827
|
+
str = "%s..." % lines.first
|
828
|
+
str += "\e[0m" if @context.use_colorize
|
816
829
|
multiline_p = false
|
817
830
|
else
|
818
831
|
str = str.gsub(/(\A.*?\n).*/m, "\\1...")
|
832
|
+
str += "\e[0m" if @context.use_colorize
|
819
833
|
end
|
820
834
|
else
|
821
835
|
output_width = Reline::Unicode.calculate_width(@context.return_format % str, true)
|
822
836
|
diff_size = output_width - Reline::Unicode.calculate_width(str, true)
|
823
837
|
if diff_size.positive? and output_width > winwidth
|
824
838
|
lines, _ = Reline::Unicode.split_by_width(str, winwidth - diff_size - 3)
|
825
|
-
str = "%s
|
839
|
+
str = "%s..." % lines.first
|
840
|
+
str += "\e[0m" if @context.use_colorize
|
826
841
|
end
|
827
842
|
end
|
828
843
|
end
|
@@ -856,7 +871,7 @@ module IRB
|
|
856
871
|
|
857
872
|
# If the expression is invalid, Ripper.sexp should return nil which will
|
858
873
|
# result in false being returned. Any valid expression should return an
|
859
|
-
# s-expression where the second
|
874
|
+
# s-expression where the second element of the top level array is an
|
860
875
|
# array of parsed expressions. The first element of each expression is the
|
861
876
|
# expression's type.
|
862
877
|
verbose, $VERBOSE = $VERBOSE, nil
|
data/man/irb.1
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
.Op Fl - Ns Oo no Oc Ns singleline
|
19
19
|
.Op Fl - Ns Oo no Oc Ns echo
|
20
20
|
.Op Fl - Ns Oo no Oc Ns colorize
|
21
|
+
.Op Fl - Ns Oo no Oc Ns autocomplete
|
21
22
|
.Op Fl - Ns Oo no Oc Ns verbose
|
22
23
|
.Op Fl -prompt Ar mode
|
23
24
|
.Op Fl -prompt-mode Ar mode
|
@@ -104,13 +105,27 @@ Uses singleline editor module.
|
|
104
105
|
Doesn't use singleline editor module.
|
105
106
|
.Pp
|
106
107
|
.Pp
|
108
|
+
.It Fl -extra-doc-dir
|
109
|
+
Add an extra doc dir for the doc dialog.
|
110
|
+
.Pp
|
111
|
+
.Pp
|
107
112
|
.It Fl -echo
|
108
|
-
Show result(default).
|
113
|
+
Show result (default).
|
109
114
|
.Pp
|
110
115
|
.It Fl -noecho
|
111
116
|
Don't show result.
|
112
117
|
.Pp
|
113
118
|
.Pp
|
119
|
+
.It Fl -echo-on-assignment
|
120
|
+
Show result on assignment.
|
121
|
+
.Pp
|
122
|
+
.It Fl -noecho-on-assignment
|
123
|
+
Don't show result on assignment.
|
124
|
+
.Pp
|
125
|
+
.It Fl -truncate-echo-on-assignment
|
126
|
+
Show truncated result on assignment (default).
|
127
|
+
.Pp
|
128
|
+
.Pp
|
114
129
|
.It Fl -colorize
|
115
130
|
Use colorization.
|
116
131
|
.Pp
|
@@ -118,6 +133,13 @@ Use colorization.
|
|
118
133
|
Don't use colorization.
|
119
134
|
.Pp
|
120
135
|
.Pp
|
136
|
+
.It Fl -autocomplete
|
137
|
+
Use autocompletion.
|
138
|
+
.Pp
|
139
|
+
.It Fl -noautocomplete
|
140
|
+
Don't use autocompletion.
|
141
|
+
.Pp
|
142
|
+
.Pp
|
121
143
|
.It Fl -verbose
|
122
144
|
Show details.
|
123
145
|
.Pp
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiju ISHITSUKA
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reline
|
15
|
-
prerelease: false
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
17
|
- - ">="
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
19
|
+
version: 0.3.0
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.3.0
|
27
27
|
description: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).
|
28
28
|
email:
|
29
29
|
- keiju@ruby-lang.org
|
@@ -97,7 +97,7 @@ licenses:
|
|
97
97
|
- Ruby
|
98
98
|
- BSD-2-Clause
|
99
99
|
metadata: {}
|
100
|
-
post_install_message:
|
100
|
+
post_install_message:
|
101
101
|
rdoc_options: []
|
102
102
|
require_paths:
|
103
103
|
- lib
|
@@ -112,8 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
116
|
-
signing_key:
|
115
|
+
rubygems_version: 3.2.22
|
116
|
+
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).
|
119
119
|
test_files: []
|