Class: Debtective::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/debtective/command.rb

Overview

Handle commands from CLI

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Command

Returns a new instance of Command.

Parameters:

  • args (Array<String>)

    ARGVs from command line (order matters)



10
11
12
# File 'lib/debtective/command.rb', line 10

def initialize(args)
  @args = args
end

Instance Method Details

#callObject

Forward to the proper command



15
16
17
18
19
20
21
22
23
24
# File 'lib/debtective/command.rb', line 15

def call
  case @args.first&.delete("--")
  when "comments"
    Debtective::Comments::Command.new(@args, quiet: quiet?).call
  when "gems"
    puts "Upcoming feature!"
  else
    puts "Please pass one of this options: [--comments, --gems]"
  end
end