Sha256: bde1c88b8bac3041a8c9849d61ee9e34871f17b98c584e6694c20106dd62965a

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

module HabiticaCli
  # Responsible for displaying a "dashboard" of stats
  # and tasks for a user as well as caching them
  module Commands
    def self.status(env)
      response = env.api.get('user')
      if response.success?
        puts status_display(response.body)
        display(env, response.body['todos'] + response.body['dailys'], nil)
      else
        puts "Error: #{response.error}"
      end
    end

    def self.status_display(body)
      stats = body['stats']
      puts [
        "Gold: #{stats['gp'].round}",
        "Health: #{stats['hp'].round}/#{stats['maxHealth']}"
      ].join(' | ')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
habitica_cli-0.0.1 lib/habitica_cli/commands/status.rb