[ruby/optparse] Fix LESS environment variable setup in OptionParser#help_exit
If the original value of LESS ends with an option starting with "--", simply appending "Fe" would result in an invalid option string. https://github.com/ruby/optparse/commit/30571f91d3
This commit is contained in:
parent
f4c16c57aa
commit
3cd3f76679
@ -1058,7 +1058,7 @@ XXX
|
||||
def help_exit
|
||||
if $stdout.tty? && (pager = ENV.values_at(*%w[RUBY_PAGER PAGER]).find {|e| e && !e.empty?})
|
||||
less = ENV["LESS"]
|
||||
args = [{"LESS" => "#{!less || less.empty? ? '-' : less}Fe"}, pager, "w"]
|
||||
args = [{"LESS" => "#{less} -Fe"}, pager, "w"]
|
||||
print = proc do |f|
|
||||
f.puts help
|
||||
rescue Errno::EPIPE
|
||||
|
Loading…
x
Reference in New Issue
Block a user