tn - a taskwarrior script to show my my most important tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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