Sha256: 842ee965e41c377ba42e0fb0fe93a125d48f66bccd35ca3ae29cad3c1811049d

Contents?: true

Size: 504 Bytes

Versions: 1

Compression:

Stored size: 504 Bytes

Contents

module HabiticaCli
  # responsible for adding new todos, tasks, and dailies
  # also for for caching the newly added todo
  module Commands
    def self.add(env, type, text)
      validate_type(type)
      response = env.api.post('user/tasks', type: type, text: text)

      if response.success?
        task = cache_tasks(env, [response.body], type).first
        puts "Added #{task['text']} [#{task['cid']}]"
      else
        puts "Error adding #{text}: #{response.body}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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