Class: Ididthis::CommandLine

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

Instance Method Summary collapse

Instance Method Details

#configureObject



14
15
16
17
# File 'lib/ididthis/cli.rb', line 14

def configure
  Config.configure!
  puts "Config file created at #{Config::PATH.inspect}"
end

#donesObject



45
46
47
48
49
50
51
52
53
# File 'lib/ididthis/cli.rb', line 45

def dones
  query_mappings = { date: "done_date", after: "done_date_after", before: "done_date_before", order: "order_by", limit: "page_size" }
  params = Hash[options.map { |k, v| [query_mappings[k] || k, v] }]
  c = Ididthis::API::Client.new
  dones = c.get_dones(Ididthis::Config[:token], params)
  dones.each do |done|
    puts "#{yellow(done[:done_date])} #{green(done[:owner])}\t#{done[:raw_text]}".gsub(/(#\b[^\s]+\b)/, "\e[31m\\1\e[0m")
  end
end

#post(done) ⇒ Object



28
29
30
31
# File 'lib/ididthis/cli.rb', line 28

def post(done)
  c = Ididthis::API::Client.new
  c.post_done(Ididthis::Config[:token], options[:goal] ? "[] #{done}" : done, options[:team], options)
end

#teamsObject



56
57
# File 'lib/ididthis/cli.rb', line 56

def teams
end