class MxxRu::Generators::ExtCMakeProject::Options

Class for storing command-line arguments as options.

Usage:

options = Options.parse( args, banner )

Attributes

output_file[RW]

Name of output file (-o, –output-file). nil if missing.

where[RW]

Name of subfolder with CMakeLists.txt file

Public Class Methods

parse( args, banner ) click to toggle source

Parsing command-line arguments and returning Options instance.

Calls exit(1) if –help present in args.

# File lib/mxx_ru/generators/ext-cmake-prj/g.rb, line 59
def Options.parse( args, banner )
  parser = OptionParser.new

  result = Options.new

  parser.banner = banner

  parser.on( '-w', '--where SUBFOLDER', 'Name of subfolder with CMakeLists.txt' ) do |p|
    result.where = p
  end
  parser.on( '-o', '--output-file FILE', 'Output file name' ) do |p|
    result.output_file = p
  end

  parser.on_tail( '-h', '--help', 'Show this message' ) do
    puts parser
    exit(1)
  end

  parser.parse!(args)

  result
end