Skip to content

Instantly share code, notes, and snippets.

@GregPK
Created August 4, 2019 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GregPK/25bbc481887293f3e8d1c6cc33aebca5 to your computer and use it in GitHub Desktop.
Save GregPK/25bbc481887293f3e8d1c6cc33aebca5 to your computer and use it in GitHub Desktop.
tn - a taskwarrior script to show my my most important tasks
#!/usr/bin/ruby
require 'time'
filters = []
configs = []
hour = Time.now.hour
def is_weekend?
t = Time.now
t.saturday? || t.sunday?
end
if is_weekend?
configs << 'rc.urgency.uda.project.Me.Skills.coefficient=4'
configs << 'rc.urgency.uda.project.Fun.coefficient=4'
configs << 'rc.urgency.uda.project.Toptal.coefficient=-8'
end
if hour >= 19 # should be winding down now
configs << 'rc.urgency.uda.project.Toptal.coefficient=-5' unless is_weekend?
if hour >= 22 #too late for work, good time for relax
filters << 'project!~Toptal'
configs << 'rc.urgency.uda.project.Fun.coefficient=5'
end
end
filters_str = "'(" + filters.join(' and ') + ")' " unless filters.empty?
configuration_str = configs.join(' ') + " " unless configs.empty?
cmd = "task #{filters_str}#{configuration_str}next limit:3"
puts cmd
system cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment