Adds help to todo script

Jonathan Hodgson 5 years ago
parent b634044c16
commit a7ab6513bb
  1. 16
      bin/.bin/todo

@ -8,6 +8,18 @@ function is_int() {
return $(test "$@" -eq "$@" > /dev/null 2>&1); return $(test "$@" -eq "$@" > /dev/null 2>&1);
} }
function help(){
echo "TODO"
echo "===="
echo "Simple todo list manager"
echo ""
(
echo "list|l List contents of to do list"
echo "add|a \"Description\" Add an item to the todo list"
echo "delete|del|d \"item id\" Delete an item from the todo list"
) | column -t -s' '
}
function list(){ function list(){
if [ -f "$FILE" ]; then if [ -f "$FILE" ]; then
awk '{printf("%5d : %s\n", NR,$0)}' "$FILE" awk '{printf("%5d : %s\n", NR,$0)}' "$FILE"
@ -49,6 +61,10 @@ if [ -n "$1" ]; then
delete "$@" delete "$@"
exit 0 exit 0
;; ;;
"help"|"--help"|"-h")
help
exit 0
;;
*) *)
echo "Command $1 unknown" echo "Command $1 unknown"
exit 1 exit 1

Loading…
Cancel
Save