From 29532bc4814051a842df34c05aa74b18dcfd5dea Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 15 Aug 2019 18:20:37 +0200 Subject: use [yyyy-mm-dd] for time stamps --- README.md | 10 +++++----- notagain | 2 +- notyet | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 56432cd..a522577 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ than the previous task, it is regarded as a subtask. notyet has no limit on indentation depth. I recommend using two spaces for each level. -Additionally, a task can have a deadline if it starts with the ISO -format `YYYY-MM-DD`. +Additionally, a task can have an assigned date if it starts with the +ISO format `[YYYY-MM-DD]` or `[YYYY-MM-DD HH:MM]`. When you run notyet, it will read the task file (by default `~/.notyet`, use `-f` to override) and *aggregate the tasks*: @@ -59,7 +59,7 @@ x buy a present - Zebby - Orraleen ? Xana -- 2017-10-16 birthday cake +- [2017-10-16] birthday cake ? sprinkles - flour - sugar @@ -81,8 +81,8 @@ To get an overview of what remains to do, we run: ``` % notyet -f party.ny -2017-10-16 {+14} [3/10] -- 2017-10-16 {+14} birthday cake [2/6] +[2017-10-16] {+14} [3/10] +- [2017-10-16] {+14} birthday cake [2/6] - eggs - flour - sugar diff --git a/notagain b/notagain index faa40b4..214561b 100755 --- a/notagain +++ b/notagain @@ -21,7 +21,7 @@ def parse(io, filename=nil) force = "-" if $always # - support Rnn/P for limited repetitions? - if desc =~ %r{(\d\d\d\d-\d\d-\d\d)(.*)(R/P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)} + if desc =~ %r{\[(\d\d\d\d-\d\d-\d\d)(?: \d\d:\d\d)?\](.*)(R/P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)} date = Date.parse($1) before, mid, after = $`, $2, $' diff --git a/notyet b/notyet index 5b8b894..c499aba 100755 --- a/notyet +++ b/notyet @@ -65,17 +65,17 @@ class Entry < Struct.new(:depth, :state, :desc, :file, :line, :children) force(state) if "?xX".index(state) - if desc =~ /^(?:\(.*?\)\s*)?(\d\d\d\d-\d\d-\d\d)/ + if desc =~ /^(?:\(.*?\)\s*)?\[(\d\d\d\d-\d\d-\d\d)( \d\d:\d\d)?\]/ diff = "%+d" % (Date.parse($1) - TODAY) - self.desc = "#{$1} {#{diff}}#{$'}" + self.desc = "[#{$1}#{$2}] {#{diff}}#{$'}" else soonest = children.map { |c| "-?".index(c.state) && - c.desc[/^(?:\(.*?\)\s*)?(\d\d\d\d-\d\d-\d\d)/, 1] + c.desc[/^(?:\(.*?\)\s*)?\[(\d\d\d\d-\d\d-\d\d)( \d\d:\d\d)?\]/, 1] }.compact.min if soonest diff = "%+d" % (Date.parse(soonest) - TODAY) - self.desc = "#{soonest} {#{diff}} #{desc}" + self.desc = "[#{soonest}] {#{diff}} #{desc}" end end end -- cgit 1.4.1