Class: SimpleFeatureFlags::Cli::Options
- Inherits:
-
Object
- Object
- SimpleFeatureFlags::Cli::Options
- Extended by:
- T::Sig
- Defined in:
- lib/simple_feature_flags/cli/options.rb
Overview
Parses CLI options.
Instance Attribute Summary collapse
-
#generate ⇒ Object
readonly
: bool.
-
#opt_parser ⇒ Object
readonly
: OptionParser.
-
#rails ⇒ Object
readonly
: bool.
-
#ui ⇒ Object
readonly
: bool.
Instance Method Summary collapse
-
#initialize(args) ⇒ Options
constructor
: (Array args) -> void.
Constructor Details
#initialize(args) ⇒ Options
: (Array args) -> void
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/simple_feature_flags/cli/options.rb', line 25 def initialize(args) @rails = true #: bool @ui = false #: bool @generate = false #: bool @opt_parser = ::OptionParser.new do |opts| opts. = 'Usage: simple_feature_flags [options]' opts.separator '' opts.separator 'Commands:' opts.on('-g', '--generate', 'Generate necessary config files') { @generate = true } opts.on('-h', '--help', 'Display the manual') do puts opts exit end opts.on('-v', '--version', 'Show gem version') do puts VERSION exit end opts.separator '' opts.separator 'Modifiers:' opts.on('--[no-]ui', '--[no-]web-ui', "Add the #{UI_GEM} gem and mount it in routes") { |u| @ui = u } opts.on('--[no-]rails', 'Use generators suited for Rails apps') { |r| @rails = r } end opt_parser.parse!(args) end |
Instance Attribute Details
#generate ⇒ Object (readonly)
: bool
16 17 18 |
# File 'lib/simple_feature_flags/cli/options.rb', line 16 def generate @generate end |
#opt_parser ⇒ Object (readonly)
: OptionParser
13 14 15 |
# File 'lib/simple_feature_flags/cli/options.rb', line 13 def opt_parser @opt_parser end |
#rails ⇒ Object (readonly)
: bool
19 20 21 |
# File 'lib/simple_feature_flags/cli/options.rb', line 19 def rails @rails end |
#ui ⇒ Object (readonly)
: bool
22 23 24 |
# File 'lib/simple_feature_flags/cli/options.rb', line 22 def ui @ui end |