7fac1bdc46e7f3e832e09f33b834f81e0ee86c99 — Charles Daniels 2 months ago f2b0d15
lstodo improvements

* sort completed tasks by time completed
* dont show X on TTY, just strikethrough
1 files changed, 8 insertions(+), 4 deletions(-)

M overlay/bin/joplin-lstodo
M overlay/bin/joplin-lstodo => overlay/bin/joplin-lstodo +8 -4
@@ 53,11 53,15 @@ curl -s "$URL/notes?token=$TOKEN" | \
 			due="X        "
 			COLOR="GREY"
 		fi
-		printf "$due\t$title\t$COLOR\n"
+		printf "$complete\t$due\t$title\t$COLOR\n"
 	done ) | \
-	sort -s | while read -r entry ; do
-		COLOR="$(echo "$entry" | cut -f 3)"
-		REST="$(echo "$entry" | cut -f 1,2)"
+	sort -s -k 2,2 -k1,1r | while read -r entry ; do
+		COLOR="$(echo "$entry" | cut -f 4)"
+		if [ -t 1 ] ; then
+			REST="$(echo "$entry" | cut -f 2,3 | sed 's/^X        /\\t/g')"
+		else
+			REST="$(echo "$entry" | cut -f 2,3)"
+		fi
 		if [ "$COLOR" = "NC" ] ; then
 			COLOR="$NC"
 		elif [ "$COLOR" = "GREY" ] ; then