aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2023-11-09 22:15:22 +0900
committergit <svn-admin@ruby-lang.org>2023-11-09 13:15:26 +0000
commitc4efd170616c3ee82a07fda04f878120f1a97e98 (patch)
treecf900363fc04292a2b31425a0ffa68ed50647f65 /lib/irb
parentae1fad4cd7d88b464aaebad3d5769d27ba675183 (diff)
downloadruby-c4efd170616c3ee82a07fda04f878120f1a97e98.tar.gz
[ruby/irb] Add command line option to select which completor to use
(https://github.com/ruby/irb/pull/754) * Add command line option to select which completor to use * Add test for completor argv https://github.com/ruby/irb/commit/1dec2708c9
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/init.rb4
-rw-r--r--lib/irb/lc/help-message3
-rw-r--r--lib/irb/lc/ja/help-message3
3 files changed, 10 insertions, 0 deletions
diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index e9111974f0..470903b451 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -330,6 +330,10 @@ module IRB # :nodoc:
@CONF[:USE_AUTOCOMPLETE] = true
when "--noautocomplete"
@CONF[:USE_AUTOCOMPLETE] = false
+ when "--regexp-completor"
+ @CONF[:COMPLETOR] = :regexp
+ when "--type-completor"
+ @CONF[:COMPLETOR] = :type
when /^--prompt-mode(?:=(.+))?/, /^--prompt(?:=(.+))?/
opt = $1 || argv.shift
prompt_mode = opt.upcase.tr("-", "_").intern
diff --git a/lib/irb/lc/help-message b/lib/irb/lc/help-message
index 7e66100be9..c7846b755d 100644
--- a/lib/irb/lc/help-message
+++ b/lib/irb/lc/help-message
@@ -30,6 +30,9 @@ Usage: irb.rb [options] [programfile] [arguments]
--nocolorize Don't use color-highlighting.
--autocomplete Use auto-completion (default).
--noautocomplete Don't use auto-completion.
+ --regexp-completor
+ Use regexp based completion (default).
+ --type-completor Use type based completion.
--prompt prompt-mode, --prompt-mode prompt-mode
Set prompt mode. Pre-defined prompt modes are:
'default', 'classic', 'simple', 'inf-ruby', 'xmp', 'null'.
diff --git a/lib/irb/lc/ja/help-message b/lib/irb/lc/ja/help-message
index 1c15d331ea..cec339cf2f 100644
--- a/lib/irb/lc/ja/help-message
+++ b/lib/irb/lc/ja/help-message
@@ -21,6 +21,9 @@ Usage: irb.rb [options] [programfile] [arguments]
--nocolorize 色付けを利用しない.
--autocomplete オートコンプリートを利用する.
--noautocomplete オートコンプリートを利用しない.
+ --regexp-completor
+ 補完に正規表現を利用する.
+ --type-completor 補完に型情報を利用する.
--prompt prompt-mode/--prompt-mode prompt-mode
プロンプトモードを切替えます. 現在定義されているプ
ロンプトモードは, default, simple, xmp, inf-rubyが