Skip to content

Instantly share code, notes, and snippets.

@craigeley
Last active February 28, 2016 18:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigeley/9509906 to your computer and use it in GitHub Desktop.
Save craigeley/9509906 to your computer and use it in GitHub Desktop.
Set this script to run at various times using launchd to automatically add lines to TaskPaper files if they don't exist. A solution for recurring tasks for plain-text task management.
#!/usr/bin/ruby
# Change to your filepath in lines 9 and 12
# Add your exact search term to line 9
# Add your exact to-do in line 13
require 'time'
today = Time.now.strftime('%Y-%m-%d')
if File.readlines('/Users/USERNAME/Dropbox/Listacular/list.taskpaper', encoding: 'UTF-8').grep(/TERM/).any?
exit
else
open('/Users/USERNAME/Dropbox/Listacular/list.taskpaper', 'a') { |f|
f.puts "- Do this task @due(#{today} 23:00)" + "\n"}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment