[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

1dec2708c9
This commit is contained in:
tomoya ishida 2023-11-09 22:15:22 +09:00 committed by git
parent ae1fad4cd7
commit c4efd17061
5 changed files with 33 additions and 0 deletions

View file

@ -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