Class: Shell::Options
- Inherits:
-
Object
- Object
- Shell::Options
- Includes:
- ChefConfig::Mixin::DotD, ChefLicensing::CLIFlags::MixlibCLI, Mixlib::CLI
- Defined in:
- lib/chef/shell.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.footer(text = nil) ⇒ Object
234 235 236 237 |
# File 'lib/chef/shell.rb', line 234 def self.(text = nil) @footer = text if text @footer end |
.print_help ⇒ Object
359 360 361 362 363 364 365 366 367 368 |
# File 'lib/chef/shell.rb', line 359 def self.print_help instance = new instance.([]) puts instance.opt_parser puts puts puts Chef::Licensing.licensing_help if ChefUtils::Dist::Infra::SHELL == "chef-shell" puts exit 1 end |
.setup! ⇒ Object
370 371 372 |
# File 'lib/chef/shell.rb', line 370 def self.setup! new.parse_opts end |
Instance Method Details
#parse_opts ⇒ Object
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/chef/shell.rb', line 374 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 # This code should not exist. # We should be using Application::Client and then calling load_config_file # which does all this properly. However this will do for now. config[:config_file] = config_file_for_shell_mode(environment) config_msg = config[:config_file] || "none (standalone session)" puts "loading configuration: #{config_msg}" # load the config (if we have one) unless config[:config_file].nil? if File.exist?(config[:config_file]) && File.readable?(config[:config_file]) Chef::Config.from_file(config[:config_file]) end # even if we couldn't load that, we need to tell Chef::Config what # the file was so it sets conf dir and d_dir and such properly Chef::Config[:config_file] = config[:config_file] # now attempt to load any relevant dot-dirs load_dot_d(Chef::Config[:client_d_dir]) if Chef::Config[:client_d_dir] end # finally merge command-line options in Chef::Config.merge!(config) end |