tSimple todo list manager - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 838a79c6561ff117e4a04df0fa08a1a689a034ca
(DIR) parent 3da0037757c08b1356528410ee3302216d9de494
(HTM) Author: z3bra <willy@mailoo.org>
Date: Fri, 17 Oct 2014 15:03:10 +0200
Simple todo list manager
Diffstat:
A todo | 32 +++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/todo b/todo
t@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# z3bra - (c) wtfpl 2014
+# Manage a todo list.
+# The file is just plain text, with one line per task.
+# This script just provide "shorter" commands to append to the file and display
+# its content. For more complex tasks, use other tools like `sed`.
+
+#Where's the file ?
+TODO=${TODO:-$HOME/.todo}
+
+# List the content of the file with some fancy headers
+list() {
+ test -f $TODO || { echo "nothing to do, enjoy."; exit 0; }
+ echo
+ echo "TODO:"
+ echo "====="
+ echo
+ # WOAH, MUCH CLEVER !
+ cat -n $TODO
+ echo
+}
+
+append() {
+ # append all arguments "as-is" to the file
+ echo "$*" >> $TODO
+}
+
+# append arguments to the file, or print it otherwise
+test -n "$*" && append $* || list
+
+exit 0