Fix `due' subcommand by handling more gracefully commands in AWK - justdoit - Simpler (but with not all the features) reimplementation todo.txt CLI
HTML hg clone https://bitbucket.org/iamleot/justdoit
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR changeset 8d69dd7ce60a69da1cc19da11425f7f57bc670b0
DIR parent 031ccde979f213b32b4174f69cbe81ae796799d9
HTML Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sat, 15 Sep 2018 13:17:11
Fix `due' subcommand by handling more gracefully commands in AWK
Inject date(1) command in a `cmd' variable and always close() it to avoid
possible buffering and bugs when using `due' subcommands.
Diffstat:
t.sh | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff -r 031ccde979f2 -r 8d69dd7ce60a t.sh
--- a/t.sh Tue Aug 21 01:34:48 2018 +0200
+++ b/t.sh Sat Sep 15 13:17:11 2018 +0200
@@ -235,12 +235,16 @@
awk -v days="${days}" '
function date_to_seconds(date) {
- "date -d " date " +%s" | getline
+ cmd = "date -d " date " +%s"
+ cmd | getline
+ close(cmd)
return $0
}
function seconds_to_date(seconds) {
- "date -r " seconds " +%Y%m%d" | getline
+ cmd = "date -r " seconds " +%Y%m%d"
+ cmd | getline
+ close(cmd)
return $0
}