# typed: false # frozen_string_literal: true require 'thor' module Moneylovercli # Handle the application command line parsing # and the dispatch to various command objects # # @api public class CLI < Thor # Error raised by this runner Error = Class.new(StandardError) desc 'version', 'moneylovercli version' def version require_relative 'version' puts "v#{Moneylovercli::VERSION}" end map %w(--version -v) => :version desc 'add_transaction', 'Command description...' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' def add_transaction(*) if options[:help] invoke :help, ['add_transaction'] else require_relative 'commands/add_transaction' Moneylovercli::Commands::AddTransaction.new(options).execute end end desc 'login', 'Command description...' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' def login(*) if options[:help] invoke :help, ['login'] else require_relative 'commands/login' Moneylovercli::Commands::Login.new(options).execute end end desc 'login USERNAME PASSWORD', 'Command description...' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' desc 'wallets', 'Command description...' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' def wallets(*) if options[:help] invoke :help, ['wallets'] else require_relative 'commands/wallets' Moneylovercli::Commands::Wallets.new(options).execute end end end end