diff options
author | Summer ☀️ <4400771+smmr0@users.noreply.github.com> | 2023-08-20 11:21:57 -0600 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-08-20 17:22:01 +0000 |
commit | 725ca2f9d808d180c57eaf49c2dd6bfcb9f701e4 (patch) | |
tree | 8ae57c283278d0a0b83170817583a4729c20d6a8 /lib/irb/cmd | |
parent | 5c75dc51b7ea956d94db8123f4501e5e7f5957ae (diff) |
[ruby/irb] Support `VISUAL` env var, and prefer it over `EDITOR`
(https://github.com/ruby/irb/pull/686)
* Support `VISUAL` env var, and prefer it over `EDITOR`
* Update test/irb/test_cmd.rb
---------
https://github.com/ruby/irb/commit/399b872c31
Co-authored-by: Stan Lo <stan001212@gmail.com>
Diffstat (limited to 'lib/irb/cmd')
-rw-r--r-- | lib/irb/cmd/edit.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/irb/cmd/edit.rb b/lib/irb/cmd/edit.rb index 523a1dac5d..69606beea0 100644 --- a/lib/irb/cmd/edit.rb +++ b/lib/irb/cmd/edit.rb @@ -8,7 +8,7 @@ module IRB module ExtendCommand class Edit < Nop category "Misc" - description 'Open a file with the editor command defined with `ENV["EDITOR"]`.' + description 'Open a file with the editor command defined with `ENV["VISUAL"]` or `ENV["EDITOR"]`.' class << self def transform_args(args) @@ -45,12 +45,12 @@ module IRB end end - if editor = ENV['EDITOR'] + if editor = (ENV['VISUAL'] || ENV['EDITOR']) puts "command: '#{editor}'" puts " path: #{path}" system(*Shellwords.split(editor), path) else - puts "Can not find editor setting: ENV['EDITOR']" + puts "Can not find editor setting: ENV['VISUAL'] or ENV['EDITOR']" end end end |