Class: MxxRu::Generators::Externals::Options
- Inherits:
-
Object
- Object
- MxxRu::Generators::Externals::Options
- Defined in:
- lib/mxx_ru/generators/externals/g.rb
Overview
Instance Attribute Summary collapse
-
#output_file ⇒ Object
Name of output file (-o, –output-file).
Class Method Summary collapse
-
.parse(args, banner) ⇒ Object
Parsing command-line arguments and returning Options instance.
Instance Attribute Details
#output_file ⇒ Object
Name of output file (-o, –output-file). nil if missing.
51 52 53 |
# File 'lib/mxx_ru/generators/externals/g.rb', line 51 def output_file @output_file end |
Class Method Details
.parse(args, banner) ⇒ Object
Parsing command-line arguments and returning Options instance.
Calls exit(1) if –help present in args.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/mxx_ru/generators/externals/g.rb', line 57 def Options.parse( args, ) parser = OptionParser.new result = Options.new parser. = 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 |