Class: AmberExtensionGenerator::CLI::Args
- Inherits:
-
Object
- Object
- AmberExtensionGenerator::CLI::Args
- Defined in:
- lib/amber_extension_generator/cli/args.rb
Overview
Parses and wraps all provided CLI arguments.
Constant Summary collapse
- BANNER =
<<~DOC Usage: amber_extension_generator GEM_PATH amber_extension_generator [options] DOC
Instance Attribute Summary collapse
-
#gem_path ⇒ Pathname
Path of the newly generated gem.
Class Method Summary collapse
Instance Attribute Details
#gem_path ⇒ Pathname
Returns Path of the newly generated gem.
44 45 46 |
# File 'lib/amber_extension_generator/cli/args.rb', line 44 def gem_path @gem_path end |
Class Method Details
.parse(argv = ::ARGV) ⇒ self
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/amber_extension_generator/cli/args.rb', line 19 def parse(argv = ::ARGV) args = new opt_parser = ::OptionParser.new do |opts| opts. = BANNER opts.on('-v', '--version', 'Show the version of the gem') do |_val| puts VERSION exit end opts.on('-h', '--help', 'Show this help') do |_val| puts opts exit end end args.gem_path = ::Pathname.new(::File.(argv.first)) opt_parser.parse(argv) args end |