class HabiticaCli::Main
At the moment this holds all tasks until we can figure out a better way to split out top level tasks into individual files (thor's DSL makes that a little bit of a chore)
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/habitica_cli/main.rb, line 10 def initialize(*args) super(*args) @cache = cache @options = options @api = configure_api end
Public Instance Methods
add(type, text)
click to toggle source
# File lib/habitica_cli/main.rb, line 30 def add(type, text) Commands.add(env, type, text) end
clear()
click to toggle source
# File lib/habitica_cli/main.rb, line 40 def clear Commands.clear(env) end
do(*cache_ids)
click to toggle source
# File lib/habitica_cli/main.rb, line 35 def do(*cache_ids) Commands.do(env, cache_ids) end
list(*args)
click to toggle source
# File lib/habitica_cli/main.rb, line 20 def list(*args) Commands.list(env, *args) end
status()
click to toggle source
# File lib/habitica_cli/main.rb, line 25 def status Commands.status(env) end
Private Instance Methods
cache()
click to toggle source
# File lib/habitica_cli/main.rb, line 67 def cache @cache ||= Cache.new end
configure_api()
click to toggle source
# File lib/habitica_cli/main.rb, line 54 def configure_api config = Config.new(@options) user, key = config.user_and_api_key if user.nil? || key.nil? help puts config.usage exit 1 end @api = Api.new(user, key) end
env()
click to toggle source
# File lib/habitica_cli/main.rb, line 46 def env OpenStruct.new( cache: @cache, api: @api, options: @options ) end