instance method
OptionParser#environment
(?::String env) -> ::Array[::String]?
environment(env = File.basename($0, '.*'), **keywords)
lib/optparse.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/optparse.rb, line 2082
def environment(env = File.basename($0, '.*'), **keywords)
env = ENV[env] || ENV[env.upcase] or return
require 'shellwords'
parse(*Shellwords.shellwords(env), **keywords)
end
Parses environment variable env or its uppercase with splitting like a shell.
env defaults to the basename of the program.