module Beaker::Options::SubcommandOptionsParser

A set of functions to read options files

Public Class Methods

parse_options_file(options_file_path) click to toggle source
# File lib/beaker/options/subcommand_options_file_parser.rb, line 5
def self.parse_options_file(options_file_path)
  result = OptionsHash.new
  result = YAML.load_file(options_file_path) if File.exist?(options_file_path)
  result
end
parse_subcommand_options(argv, options_file) click to toggle source

@return [OptionsHash, Hash] returns an empty OptionHash or loads subcommand options yaml

from disk
# File lib/beaker/options/subcommand_options_file_parser.rb, line 13
def self.parse_subcommand_options(argv, options_file)
  result = OptionsHash.new
  if Beaker::Subcommands::SubcommandUtil.execute_subcommand?(argv[0])
    return result if argv[0] == 'init'

    result = SubcommandOptionsParser.parse_options_file(options_file)
  end
  result
end