Class: Shell::Options
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.footer(text = nil) ⇒ Object
210 211 212 213 |
# File 'lib/chef/shell.rb', line 210 def self.(text = nil) @footer = text if text @footer end |
.print_help ⇒ Object
319 320 321 322 323 324 325 326 327 |
# File 'lib/chef/shell.rb', line 319 def self.print_help instance = new instance.([]) puts instance.opt_parser puts puts puts exit 1 end |
.setup! ⇒ Object
329 330 331 |
# File 'lib/chef/shell.rb', line 329 def self.setup! new.parse_opts end |
Instance Method Details
#parse_opts ⇒ Object
333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/chef/shell.rb', line 333 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.exist?(config[:config_file]) && File.readable?(config[:config_file]) Chef::Config.merge!(config) end |