scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit 838a79c6561ff117e4a04df0fa08a1a689a034ca
parent 3da0037757c08b1356528410ee3302216d9de494
Author: z3bra <willy@mailoo.org>
Date:   Fri Oct 17 15:03:10 +0200

Simple todo list manager

Diffstat:
todo | 32++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+), 0 deletions(-)
diff --git a/todo b/todo @@ -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