Class: Shell::Options
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.footer(text = nil) ⇒ Object
203 204 205 206 |
# File 'lib/chef/shell.rb', line 203 def self.(text = nil) = text if text end |
.print_help ⇒ Object
296 297 298 299 300 301 302 303 304 |
# File 'lib/chef/shell.rb', line 296 def self.print_help instance = new instance.([]) puts instance.opt_parser puts puts puts exit 1 end |
.setup! ⇒ Object
306 307 308 |
# File 'lib/chef/shell.rb', line 306 def self.setup! new.parse_opts end |
Instance Method Details
#parse_opts ⇒ Object
310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/chef/shell.rb', line 310 def parse_opts remainder = environment = remainder.first # We have to nuke ARGV to make sure irb's option parser never sees it. # otherwise, IRB complains about command line switches it doesn't recognize. ARGV.clear config[:config_file] = config_file_for_shell_mode(environment) config_msg = config[:config_file] || "none (standalone session)" puts "loading configuration: #{config_msg}" Chef::Config.from_file(config[:config_file]) if !config[:config_file].nil? && File.exists?(config[:config_file]) && File.readable?(config[:config_file]) Chef::Config.merge!(config) end |