I honestly thought that after I got Haskerdeux working again I’d not be doing much else to improve it, but lo and behold the whole “fix your own frustrations” thing kicked in and I ended up improving it so I could use it to work on todos of any date. Why? Because I wanted to be able to easily script adding a whole bunch of todos on various dates in the future.

I actually ended up doing some Ruby to (technically) Haskell scripting as follows:

require 'helpscout'
helpscout = HelpScout::Client.new("<api key>")

# Read in an array of "conversations" I had from a previous action
# I.e. a text file with one of something like this per line: https://api.helpscout.net/v1/conversations/326542115.json
conversations = File.readlines("conversations.txt").map(&:strip)

conversations.each do |conv|
    ticket  = helpscout.conversation(conv[43..-6])
    # DateTime.parse is clever enough to pick out date from a string like "something something needs to happen on 2017-03-05 so here's some text"
    todo_date = (DateTime.parse(ticket.preview)-1).to_date.iso8601
    `./haskerdeux #{todo_date} new "Need to do this before tomorrow [#{ticket.number}](#{ticket.url})"`
end

(This Helpscout Ruby gem is really good, by the way).

I.e. I had a list of HelpScout conversations that had been generated previously and I had actions based on these I needed to do on a certain date. So I iterated through each conversation, parsed the date from the ticket preview text and then added them to my Teuxdeux list via a Ruby shell/system call to Haskerdeux. Simple, hacky, nifty.