Class: Moneylovercli::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/moneylovercli/cli.rb

Overview

Handle the application command line parsing and the dispatch to various command objects

Constant Summary collapse

Error =

Error raised by this runner

Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#add_transactionObject



25
26
27
28
29
30
31
32
# File 'lib/moneylovercli/cli.rb', line 25

def add_transaction(*)
  if options[:help]
    invoke :help, ['add_transaction']
  else
    require_relative 'commands/add_transaction'
    Moneylovercli::Commands::AddTransaction.new(options).execute
  end
end

#loginObject



37
38
39
40
41
42
43
44
# File 'lib/moneylovercli/cli.rb', line 37

def (*)
  if options[:help]
    invoke :help, ['login']
  else
    require_relative 'commands/login'
    Moneylovercli::Commands::Login.new(options).execute
  end
end

#versionObject



16
17
18
19
# File 'lib/moneylovercli/cli.rb', line 16

def version
  require_relative 'version'
  puts "v#{Moneylovercli::VERSION}"
end

#walletsObject



53
54
55
56
57
58
59
60
# File 'lib/moneylovercli/cli.rb', line 53

def wallets(*)
  if options[:help]
    invoke :help, ['wallets']
  else
    require_relative 'commands/wallets'
    Moneylovercli::Commands::Wallets.new(options).execute
  end
end