Add function todo

This commit is contained in:
Xavier Logerais 2014-01-26 13:01:56 +01:00
parent 2f11992488
commit e25b37d0b6

22
libs/todo.bash Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
todo() {
if [[ ! -f $HOME/.todo ]]; then
touch $HOME/.todo
fi
if [[ $# -eq 0 ]]; then
cat $HOME/.todo
elif [[ "$1" == "-l" ]]; then
cat -n $HOME/.todo
elif [[ "$1" == "-c" ]]; then
echo "" > $HOME/.todo
elif [[ "$1" == "-r" ]]; then
cat -n $HOME/.todo
echo -ne "----------------------------\nType a number to remove: "
read NUMBER
sed -ie ${NUMBER}d $HOME/.todo
else
echo "$@" >> $HOME/.todo
fi
}