Class: Bogo::Cli::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/bogo-cli/command.rb

Overview

Abstract command class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts, args) ⇒ self

Build new command instance



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bogo-cli/command.rb', line 20

def initialize(opts, args)
  @options = opts.to_smash
  @arguments = args
  @ui = Ui.new(
    opts.fetch(
      :app_name,
      self.class.name.split('::').first
    )
  )
  load_config!
end

Instance Attribute Details

#argumentsArray (readonly)



13
14
15
# File 'lib/bogo-cli/command.rb', line 13

def arguments
  @arguments
end

#optionsHash (readonly)



11
12
13
# File 'lib/bogo-cli/command.rb', line 11

def options
  @options
end

#uiUi (readonly)



15
16
17
# File 'lib/bogo-cli/command.rb', line 15

def ui
  @ui
end

Instance Method Details

#execute!TrueClass

Execute the command

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/bogo-cli/command.rb', line 35

def execute!
  raise NotImplementedError
end