irb 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -0
- data/README.md +3 -3
- data/doc/irb/irb-tools.rd.ja +184 -0
- data/doc/irb/irb.rd.ja +411 -0
- data/irb.gemspec +58 -1
- data/lib/irb.rb +106 -35
- data/lib/irb/cmd/fork.rb +1 -1
- data/lib/irb/cmd/help.rb +9 -5
- data/lib/irb/color.rb +233 -0
- data/lib/irb/completion.rb +126 -33
- data/lib/irb/context.rb +105 -65
- data/lib/irb/ext/history.rb +47 -9
- data/lib/irb/ext/multi-irb.rb +7 -7
- data/lib/irb/ext/save-history.rb +17 -5
- data/lib/irb/ext/tracer.rb +14 -1
- data/lib/irb/ext/use-loader.rb +3 -0
- data/lib/irb/extend-command.rb +70 -48
- data/lib/irb/frame.rb +12 -7
- data/lib/irb/init.rb +30 -20
- data/lib/irb/input-method.rb +108 -3
- data/lib/irb/inspector.rb +12 -2
- data/lib/irb/lc/error.rb +55 -16
- data/lib/irb/lc/help-message +9 -6
- data/lib/irb/lc/ja/error.rb +55 -14
- data/lib/irb/lc/ja/help-message +9 -6
- data/lib/irb/locale.rb +5 -1
- data/lib/irb/notifier.rb +12 -8
- data/lib/irb/output-method.rb +6 -6
- data/lib/irb/ruby-lex.rb +345 -1039
- data/lib/irb/ruby_logo.aa +38 -0
- data/lib/irb/version.rb +2 -2
- data/lib/irb/workspace.rb +58 -20
- data/man/irb.1 +207 -0
- metadata +21 -6
- data/.gitignore +0 -9
- data/.travis.yml +0 -6
- data/lib/irb/ruby-token.rb +0 -267
- data/lib/irb/slex.rb +0 -282
data/lib/irb/ext/history.rb
CHANGED
@@ -22,7 +22,7 @@ module IRB # :nodoc:
|
|
22
22
|
def set_last_value(value)
|
23
23
|
_set_last_value(value)
|
24
24
|
|
25
|
-
if @eval_history
|
25
|
+
if defined?(@eval_history) && @eval_history
|
26
26
|
@eval_history_values.push @line_no, @last_value
|
27
27
|
@workspace.evaluate self, "__ = IRB.CurrentContext.instance_eval{@eval_history_values}"
|
28
28
|
end
|
@@ -30,9 +30,13 @@ module IRB # :nodoc:
|
|
30
30
|
@last_value
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
remove_method :eval_history= if method_defined?(:eval_history=)
|
34
|
+
# The command result history limit. This method is not available until
|
35
|
+
# #eval_history= was called with non-nil value (directly or via
|
36
|
+
# setting <code>IRB.conf[:EVAL_HISTORY]</code> in <code>.irbrc</code>).
|
34
37
|
attr_reader :eval_history
|
35
|
-
# Sets command result history limit.
|
38
|
+
# Sets command result history limit. Default value is set from
|
39
|
+
# <code>IRB.conf[:EVAL_HISTORY]</code>.
|
36
40
|
#
|
37
41
|
# +no+ is an Integer or +nil+.
|
38
42
|
#
|
@@ -41,6 +45,9 @@ module IRB # :nodoc:
|
|
41
45
|
# If +no+ is 0, the number of history items is unlimited.
|
42
46
|
#
|
43
47
|
# If +no+ is +nil+, execution result history isn't used (default).
|
48
|
+
#
|
49
|
+
# History values are available via <code>__</code> variable, see
|
50
|
+
# IRB::History.
|
44
51
|
def eval_history=(no)
|
45
52
|
if no
|
46
53
|
if defined?(@eval_history) && @eval_history
|
@@ -58,20 +65,51 @@ module IRB # :nodoc:
|
|
58
65
|
end
|
59
66
|
end
|
60
67
|
|
61
|
-
|
62
|
-
|
63
|
-
|
68
|
+
# Represents history of results of previously evaluated commands.
|
69
|
+
#
|
70
|
+
# Available via <code>__</code> variable, only if <code>IRB.conf[:EVAL_HISTORY]</code>
|
71
|
+
# or <code>IRB::CurrentContext().eval_history</code> is non-nil integer value
|
72
|
+
# (by default it is +nil+).
|
73
|
+
#
|
74
|
+
# Example (in `irb`):
|
75
|
+
#
|
76
|
+
# # Initialize history
|
77
|
+
# IRB::CurrentContext().eval_history = 10
|
78
|
+
# # => 10
|
79
|
+
#
|
80
|
+
# # Perform some commands...
|
81
|
+
# 1 + 2
|
82
|
+
# # => 3
|
83
|
+
# puts 'x'
|
84
|
+
# # x
|
85
|
+
# # => nil
|
86
|
+
# raise RuntimeError
|
87
|
+
# # ...error raised
|
88
|
+
#
|
89
|
+
# # Inspect history (format is "<item number> <evaluated value>":
|
90
|
+
# __
|
91
|
+
# # => 1 10
|
92
|
+
# # 2 3
|
93
|
+
# # 3 nil
|
94
|
+
#
|
95
|
+
# __[1]
|
96
|
+
# # => 10
|
97
|
+
#
|
98
|
+
class History
|
99
|
+
|
100
|
+
def initialize(size = 16) # :nodoc:
|
64
101
|
@size = size
|
65
102
|
@contents = []
|
66
103
|
end
|
67
104
|
|
68
|
-
def size(size)
|
105
|
+
def size(size) # :nodoc:
|
69
106
|
if size != 0 && size < @size
|
70
107
|
@contents = @contents[@size - size .. @size]
|
71
108
|
end
|
72
109
|
@size = size
|
73
110
|
end
|
74
111
|
|
112
|
+
# Get one item of the content (both positive and negative indexes work).
|
75
113
|
def [](idx)
|
76
114
|
begin
|
77
115
|
if idx >= 0
|
@@ -84,14 +122,14 @@ module IRB # :nodoc:
|
|
84
122
|
end
|
85
123
|
end
|
86
124
|
|
87
|
-
def push(no, val)
|
125
|
+
def push(no, val) # :nodoc:
|
88
126
|
@contents.push [no, val]
|
89
127
|
@contents.shift if @size != 0 && @contents.size > @size
|
90
128
|
end
|
91
129
|
|
92
130
|
alias real_inspect inspect
|
93
131
|
|
94
|
-
def inspect
|
132
|
+
def inspect # :nodoc:
|
95
133
|
if @contents.empty?
|
96
134
|
return real_inspect
|
97
135
|
end
|
data/lib/irb/ext/multi-irb.rb
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
#
|
10
10
|
#
|
11
11
|
#
|
12
|
-
|
12
|
+
fail CantShiftToMultiIrbMode unless defined?(Thread)
|
13
13
|
|
14
14
|
module IRB
|
15
15
|
class JobManager
|
@@ -67,8 +67,8 @@ module IRB
|
|
67
67
|
# exception is raised.
|
68
68
|
def switch(key)
|
69
69
|
th, irb = search(key)
|
70
|
-
|
71
|
-
|
70
|
+
fail IrbAlreadyDead unless th.alive?
|
71
|
+
fail IrbSwitchedToCurrentThread if th == Thread.current
|
72
72
|
@current_job = irb
|
73
73
|
th.run
|
74
74
|
Thread.stop
|
@@ -84,7 +84,7 @@ module IRB
|
|
84
84
|
def kill(*keys)
|
85
85
|
for key in keys
|
86
86
|
th, _ = search(key)
|
87
|
-
|
87
|
+
fail IrbAlreadyDead unless th.alive?
|
88
88
|
th.exit
|
89
89
|
end
|
90
90
|
end
|
@@ -114,7 +114,7 @@ module IRB
|
|
114
114
|
else
|
115
115
|
@jobs.find{|k, v| v.context.main.equal?(key)}
|
116
116
|
end
|
117
|
-
|
117
|
+
fail NoSuchJob, key if job.nil?
|
118
118
|
job
|
119
119
|
end
|
120
120
|
|
@@ -122,7 +122,7 @@ module IRB
|
|
122
122
|
def delete(key)
|
123
123
|
case key
|
124
124
|
when Integer
|
125
|
-
|
125
|
+
fail NoSuchJob, key unless @jobs[key]
|
126
126
|
@jobs[key] = nil
|
127
127
|
else
|
128
128
|
catch(:EXISTS) do
|
@@ -135,7 +135,7 @@ module IRB
|
|
135
135
|
throw :EXISTS
|
136
136
|
end
|
137
137
|
end
|
138
|
-
|
138
|
+
fail NoSuchJob, key
|
139
139
|
end
|
140
140
|
end
|
141
141
|
until assoc = @jobs.pop; end unless @jobs.empty?
|
data/lib/irb/ext/save-history.rb
CHANGED
@@ -27,7 +27,7 @@ module IRB
|
|
27
27
|
IRB.conf[:SAVE_HISTORY]
|
28
28
|
end
|
29
29
|
|
30
|
-
remove_method :save_history= if
|
30
|
+
remove_method :save_history= if method_defined?(:save_history=)
|
31
31
|
# Sets <code>IRB.conf[:SAVE_HISTORY]</code> to the given +val+ and calls
|
32
32
|
# #init_save_history with this context.
|
33
33
|
#
|
@@ -58,8 +58,6 @@ module IRB
|
|
58
58
|
end
|
59
59
|
|
60
60
|
module HistorySavingAbility # :nodoc:
|
61
|
-
include Readline
|
62
|
-
|
63
61
|
def HistorySavingAbility.extended(obj)
|
64
62
|
IRB.conf[:AT_EXIT].push proc{obj.save_history}
|
65
63
|
obj.load_history
|
@@ -67,18 +65,30 @@ module IRB
|
|
67
65
|
end
|
68
66
|
|
69
67
|
def load_history
|
68
|
+
return unless self.class.const_defined?(:HISTORY)
|
69
|
+
history = self.class::HISTORY
|
70
70
|
if history_file = IRB.conf[:HISTORY_FILE]
|
71
71
|
history_file = File.expand_path(history_file)
|
72
72
|
end
|
73
73
|
history_file = IRB.rc_file("_history") unless history_file
|
74
74
|
if File.exist?(history_file)
|
75
75
|
open(history_file) do |f|
|
76
|
-
f.each {|l|
|
76
|
+
f.each { |l|
|
77
|
+
l = l.chomp
|
78
|
+
if self.class == ReidlineInputMethod and history.last&.end_with?("\\")
|
79
|
+
history.last.delete_suffix!("\\")
|
80
|
+
history.last << "\n" << l
|
81
|
+
else
|
82
|
+
history << l
|
83
|
+
end
|
84
|
+
}
|
77
85
|
end
|
78
86
|
end
|
79
87
|
end
|
80
88
|
|
81
89
|
def save_history
|
90
|
+
return unless self.class.const_defined?(:HISTORY)
|
91
|
+
history = self.class::HISTORY
|
82
92
|
if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
|
83
93
|
if history_file = IRB.conf[:HISTORY_FILE]
|
84
94
|
history_file = File.expand_path(history_file)
|
@@ -91,12 +101,14 @@ module IRB
|
|
91
101
|
File.chmod(0600, history_file)
|
92
102
|
end
|
93
103
|
rescue Errno::ENOENT
|
104
|
+
rescue Errno::EPERM
|
105
|
+
return
|
94
106
|
rescue
|
95
107
|
raise
|
96
108
|
end
|
97
109
|
|
98
110
|
open(history_file, 'w', 0600 ) do |f|
|
99
|
-
hist =
|
111
|
+
hist = history.map{ |l| l.split("\n").join("\\\n") }
|
100
112
|
f.puts(hist[-num..-1] || hist)
|
101
113
|
end
|
102
114
|
end
|
data/lib/irb/ext/tracer.rb
CHANGED
@@ -9,7 +9,20 @@
|
|
9
9
|
#
|
10
10
|
#
|
11
11
|
#
|
12
|
-
|
12
|
+
begin
|
13
|
+
require "tracer"
|
14
|
+
rescue LoadError
|
15
|
+
$stderr.puts "Tracer extension of IRB is enabled but tracer gem doesn't found."
|
16
|
+
module IRB
|
17
|
+
TracerLoadError = true
|
18
|
+
class Context
|
19
|
+
def use_tracer=(opt)
|
20
|
+
# do nothing
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
return # This is about to disable loading below
|
25
|
+
end
|
13
26
|
|
14
27
|
module IRB
|
15
28
|
|
data/lib/irb/ext/use-loader.rb
CHANGED
@@ -20,10 +20,12 @@ end
|
|
20
20
|
|
21
21
|
module IRB
|
22
22
|
module ExtendCommandBundle
|
23
|
+
remove_method :irb_load if method_defined?(:irb_load)
|
23
24
|
# Loads the given file similarly to Kernel#load, see IrbLoader#irb_load
|
24
25
|
def irb_load(*opts, &b)
|
25
26
|
ExtendCommand::Load.execute(irb_context, *opts, &b)
|
26
27
|
end
|
28
|
+
remove_method :irb_require if method_defined?(:irb_require)
|
27
29
|
# Loads the given file similarly to Kernel#require
|
28
30
|
def irb_require(*opts, &b)
|
29
31
|
ExtendCommand::Require.execute(irb_context, *opts, &b)
|
@@ -44,6 +46,7 @@ module IRB
|
|
44
46
|
|
45
47
|
alias use_loader? use_loader
|
46
48
|
|
49
|
+
remove_method :use_loader= if method_defined?(:use_loader=)
|
47
50
|
# Sets IRB.conf[:USE_LOADER]
|
48
51
|
#
|
49
52
|
# See #use_loader for more information.
|
data/lib/irb/extend-command.rb
CHANGED
@@ -46,58 +46,80 @@ module IRB # :nodoc:
|
|
46
46
|
]
|
47
47
|
|
48
48
|
@EXTEND_COMMANDS = [
|
49
|
-
[
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
49
|
+
[
|
50
|
+
:irb_current_working_workspace, :CurrentWorkingWorkspace, "irb/cmd/chws",
|
51
|
+
[:irb_print_working_workspace, OVERRIDE_ALL],
|
52
|
+
[:irb_cwws, OVERRIDE_ALL],
|
53
|
+
[:irb_pwws, OVERRIDE_ALL],
|
54
|
+
[:cwws, NO_OVERRIDE],
|
55
|
+
[:pwws, NO_OVERRIDE],
|
56
|
+
[:irb_current_working_binding, OVERRIDE_ALL],
|
57
|
+
[:irb_print_working_binding, OVERRIDE_ALL],
|
58
|
+
[:irb_cwb, OVERRIDE_ALL],
|
59
|
+
[:irb_pwb, OVERRIDE_ALL],
|
60
|
+
],
|
61
|
+
[
|
62
|
+
:irb_change_workspace, :ChangeWorkspace, "irb/cmd/chws",
|
63
|
+
[:irb_chws, OVERRIDE_ALL],
|
64
|
+
[:irb_cws, OVERRIDE_ALL],
|
65
|
+
[:chws, NO_OVERRIDE],
|
66
|
+
[:cws, NO_OVERRIDE],
|
67
|
+
[:irb_change_binding, OVERRIDE_ALL],
|
68
|
+
[:irb_cb, OVERRIDE_ALL],
|
69
|
+
[:cb, NO_OVERRIDE],
|
70
|
+
],
|
68
71
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
72
|
+
[
|
73
|
+
:irb_workspaces, :Workspaces, "irb/cmd/pushws",
|
74
|
+
[:workspaces, NO_OVERRIDE],
|
75
|
+
[:irb_bindings, OVERRIDE_ALL],
|
76
|
+
[:bindings, NO_OVERRIDE],
|
77
|
+
],
|
78
|
+
[
|
79
|
+
:irb_push_workspace, :PushWorkspace, "irb/cmd/pushws",
|
80
|
+
[:irb_pushws, OVERRIDE_ALL],
|
81
|
+
[:pushws, NO_OVERRIDE],
|
82
|
+
[:irb_push_binding, OVERRIDE_ALL],
|
83
|
+
[:irb_pushb, OVERRIDE_ALL],
|
84
|
+
[:pushb, NO_OVERRIDE],
|
85
|
+
],
|
86
|
+
[
|
87
|
+
:irb_pop_workspace, :PopWorkspace, "irb/cmd/pushws",
|
88
|
+
[:irb_popws, OVERRIDE_ALL],
|
89
|
+
[:popws, NO_OVERRIDE],
|
90
|
+
[:irb_pop_binding, OVERRIDE_ALL],
|
91
|
+
[:irb_popb, OVERRIDE_ALL],
|
92
|
+
[:popb, NO_OVERRIDE],
|
93
|
+
],
|
85
94
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
95
|
+
[
|
96
|
+
:irb_load, :Load, "irb/cmd/load"],
|
97
|
+
[
|
98
|
+
:irb_require, :Require, "irb/cmd/load"],
|
99
|
+
[
|
100
|
+
:irb_source, :Source, "irb/cmd/load",
|
101
|
+
[:source, NO_OVERRIDE],
|
102
|
+
],
|
90
103
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
104
|
+
[
|
105
|
+
:irb, :IrbCommand, "irb/cmd/subirb"],
|
106
|
+
[
|
107
|
+
:irb_jobs, :Jobs, "irb/cmd/subirb",
|
108
|
+
[:jobs, NO_OVERRIDE],
|
109
|
+
],
|
110
|
+
[
|
111
|
+
:irb_fg, :Foreground, "irb/cmd/subirb",
|
112
|
+
[:fg, NO_OVERRIDE],
|
113
|
+
],
|
114
|
+
[
|
115
|
+
:irb_kill, :Kill, "irb/cmd/subirb",
|
116
|
+
[:kill, OVERRIDE_PRIVATE_ONLY],
|
117
|
+
],
|
98
118
|
|
99
|
-
|
100
|
-
|
119
|
+
[
|
120
|
+
:irb_help, :Help, "irb/cmd/help",
|
121
|
+
[:help, NO_OVERRIDE],
|
122
|
+
],
|
101
123
|
|
102
124
|
]
|
103
125
|
|
data/lib/irb/frame.rb
CHANGED
@@ -10,13 +10,18 @@
|
|
10
10
|
#
|
11
11
|
#
|
12
12
|
|
13
|
-
require "e2mmap"
|
14
|
-
|
15
13
|
module IRB
|
16
14
|
class Frame
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
class FrameOverflow < StandardError
|
16
|
+
def initialize
|
17
|
+
super("frame overflow")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
class FrameUnderflow < StandardError
|
21
|
+
def initialize
|
22
|
+
super("frame underflow")
|
23
|
+
end
|
24
|
+
end
|
20
25
|
|
21
26
|
# Default number of stack frames
|
22
27
|
INIT_STACK_TIMES = 3
|
@@ -44,7 +49,7 @@ module IRB
|
|
44
49
|
# Raises FrameUnderflow if there are no frames in the given stack range.
|
45
50
|
def top(n = 0)
|
46
51
|
bind = @frames[-(n + CALL_STACK_OFFSET)]
|
47
|
-
|
52
|
+
fail FrameUnderflow unless bind
|
48
53
|
bind
|
49
54
|
end
|
50
55
|
|
@@ -54,7 +59,7 @@ module IRB
|
|
54
59
|
# Raises FrameOverflow if there are no frames in the given stack range.
|
55
60
|
def bottom(n = 0)
|
56
61
|
bind = @frames[n]
|
57
|
-
|
62
|
+
fail FrameOverflow unless bind
|
58
63
|
bind
|
59
64
|
end
|
60
65
|
|
data/lib/irb/init.rb
CHANGED
@@ -21,7 +21,7 @@ module IRB # :nodoc:
|
|
21
21
|
IRB.load_modules
|
22
22
|
|
23
23
|
unless @CONF[:PROMPT][@CONF[:PROMPT_MODE]]
|
24
|
-
|
24
|
+
fail UndefinedPromptMode, @CONF[:PROMPT_MODE]
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -43,17 +43,19 @@ module IRB # :nodoc:
|
|
43
43
|
@CONF[:LOAD_MODULES] = []
|
44
44
|
@CONF[:IRB_RC] = nil
|
45
45
|
|
46
|
-
@CONF[:
|
46
|
+
@CONF[:USE_SINGLELINE] = false unless defined?(ReadlineInputMethod)
|
47
|
+
@CONF[:USE_COLORIZE] = true
|
47
48
|
@CONF[:INSPECT_MODE] = true
|
48
49
|
@CONF[:USE_TRACER] = false
|
49
50
|
@CONF[:USE_LOADER] = false
|
50
51
|
@CONF[:IGNORE_SIGINT] = true
|
51
52
|
@CONF[:IGNORE_EOF] = false
|
52
53
|
@CONF[:ECHO] = nil
|
54
|
+
@CONF[:ECHO_ON_ASSIGNMENT] = nil
|
53
55
|
@CONF[:VERBOSE] = nil
|
54
56
|
|
55
57
|
@CONF[:EVAL_HISTORY] = nil
|
56
|
-
@CONF[:SAVE_HISTORY] =
|
58
|
+
@CONF[:SAVE_HISTORY] = 1000
|
57
59
|
|
58
60
|
@CONF[:BACK_TRACE_LIMIT] = 16
|
59
61
|
|
@@ -82,7 +84,7 @@ module IRB # :nodoc:
|
|
82
84
|
:SIMPLE => {
|
83
85
|
:PROMPT_I => ">> ",
|
84
86
|
:PROMPT_N => ">> ",
|
85
|
-
:PROMPT_S =>
|
87
|
+
:PROMPT_S => "%l> ",
|
86
88
|
:PROMPT_C => "?> ",
|
87
89
|
:RETURN => "=> %s\n"
|
88
90
|
},
|
@@ -104,7 +106,7 @@ module IRB # :nodoc:
|
|
104
106
|
}
|
105
107
|
|
106
108
|
@CONF[:PROMPT_MODE] = (STDIN.tty? ? :DEFAULT : :NULL)
|
107
|
-
@CONF[:AUTO_INDENT] =
|
109
|
+
@CONF[:AUTO_INDENT] = true
|
108
110
|
|
109
111
|
@CONF[:CONTEXT_MODE] = 3 # use binding in function on TOPLEVEL_BINDING
|
110
112
|
@CONF[:SINGLE_IRB] = false
|
@@ -112,8 +114,6 @@ module IRB # :nodoc:
|
|
112
114
|
@CONF[:LC_MESSAGES] = Locale.new
|
113
115
|
|
114
116
|
@CONF[:AT_EXIT] = []
|
115
|
-
|
116
|
-
@CONF[:DEBUG_LEVEL] = 0
|
117
117
|
end
|
118
118
|
|
119
119
|
def IRB.init_error
|
@@ -161,18 +161,30 @@ module IRB # :nodoc:
|
|
161
161
|
end
|
162
162
|
when "--noinspect"
|
163
163
|
@CONF[:INSPECT_MODE] = false
|
164
|
-
when "--readline"
|
165
|
-
@CONF[:
|
166
|
-
when "--noreadline"
|
167
|
-
@CONF[:
|
164
|
+
when "--singleline", "--readline", "--legacy"
|
165
|
+
@CONF[:USE_SINGLELINE] = true
|
166
|
+
when "--nosingleline", "--noreadline"
|
167
|
+
@CONF[:USE_SINGLELINE] = false
|
168
|
+
when "--multiline", "--reidline"
|
169
|
+
@CONF[:USE_MULTILINE] = true
|
170
|
+
when "--nomultiline", "--noreidline"
|
171
|
+
@CONF[:USE_MULTILINE] = false
|
168
172
|
when "--echo"
|
169
173
|
@CONF[:ECHO] = true
|
170
174
|
when "--noecho"
|
171
175
|
@CONF[:ECHO] = false
|
176
|
+
when "--echo-on-assignment"
|
177
|
+
@CONF[:ECHO_ON_ASSIGNMENT] = true
|
178
|
+
when "--noecho-on-assignment"
|
179
|
+
@CONF[:ECHO_ON_ASSIGNMENT] = false
|
172
180
|
when "--verbose"
|
173
181
|
@CONF[:VERBOSE] = true
|
174
182
|
when "--noverbose"
|
175
183
|
@CONF[:VERBOSE] = false
|
184
|
+
when "--colorize"
|
185
|
+
@CONF[:USE_COLORIZE] = true
|
186
|
+
when "--nocolorize"
|
187
|
+
@CONF[:USE_COLORIZE] = false
|
176
188
|
when /^--prompt-mode(?:=(.+))?/, /^--prompt(?:=(.+))?/
|
177
189
|
opt = $1 || argv.shift
|
178
190
|
prompt_mode = opt.upcase.tr("-", "_").intern
|
@@ -191,8 +203,6 @@ module IRB # :nodoc:
|
|
191
203
|
@CONF[:CONTEXT_MODE] = ($1 || argv.shift).to_i
|
192
204
|
when "--single-irb"
|
193
205
|
@CONF[:SINGLE_IRB] = true
|
194
|
-
when /^--irb_debug(?:=(.+))?/
|
195
|
-
@CONF[:DEBUG_LEVEL] = ($1 || argv.shift).to_i
|
196
206
|
when "-v", "--version"
|
197
207
|
print IRB.version, "\n"
|
198
208
|
exit 0
|
@@ -207,7 +217,7 @@ module IRB # :nodoc:
|
|
207
217
|
end
|
208
218
|
break
|
209
219
|
when /^-/
|
210
|
-
|
220
|
+
fail UnrecognizedSwitch, opt
|
211
221
|
else
|
212
222
|
@CONF[:SCRIPT] = opt
|
213
223
|
$0 = opt
|
@@ -252,7 +262,7 @@ module IRB # :nodoc:
|
|
252
262
|
when String
|
253
263
|
return rc_file
|
254
264
|
else
|
255
|
-
|
265
|
+
fail IllegalRCNameGenerator
|
256
266
|
end
|
257
267
|
end
|
258
268
|
|
@@ -264,11 +274,11 @@ module IRB # :nodoc:
|
|
264
274
|
if home = ENV["HOME"]
|
265
275
|
yield proc{|rc| home+"/.irb#{rc}"}
|
266
276
|
end
|
267
|
-
|
268
|
-
yield proc{|rc|
|
269
|
-
yield proc{|rc|
|
270
|
-
yield proc{|rc|
|
271
|
-
yield proc{|rc|
|
277
|
+
current_dir = Dir.pwd
|
278
|
+
yield proc{|rc| current_dir+"/.irb#{rc}"}
|
279
|
+
yield proc{|rc| current_dir+"/irb#{rc.sub(/\A_?/, '.')}"}
|
280
|
+
yield proc{|rc| current_dir+"/_irb#{rc}"}
|
281
|
+
yield proc{|rc| current_dir+"/$irb#{rc}"}
|
272
282
|
end
|
273
283
|
|
274
284
|
# loading modules
|