Class: Flipper::CLI::Command

Inherits:
OptionParser
  • Object
show all
Defined in:
lib/flipper/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(program_name: nil) ⇒ Command

Returns a new instance of Command.



297
298
299
300
301
302
# File 'lib/flipper/cli.rb', line 297

def initialize(program_name: nil)
  super()
  @program_name = program_name
  @load_environment = true
  @action = lambda { }
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



295
296
297
# File 'lib/flipper/cli.rb', line 295

def description
  @description
end

#load_environmentObject

Returns the value of attribute load_environment.



295
296
297
# File 'lib/flipper/cli.rb', line 295

def load_environment
  @load_environment
end

Instance Method Details

#action(&block) ⇒ Object



309
310
311
# File 'lib/flipper/cli.rb', line 309

def action(&block)
  @action = block
end

#run(argv) ⇒ Object



304
305
306
307
# File 'lib/flipper/cli.rb', line 304

def run(argv)
  # Parse argv and call action with arguments
  @action.call(*permute(argv))
end