Add a short help message to be called for -h.

Put the old help message under a "help" command.  The
short help message just lists the available commands and
should fit on a single screen.

Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
This commit is contained in:
Emil Sit
2009-03-20 11:00:53 +08:00
committed by Gina Trapani
parent 3e7b60abcd
commit 7f5c8fb3e1

41
todo.sh
View File

@@ -27,6 +27,37 @@ EndUsage
exit 1 exit 1
} }
shorthelp()
{
sed -e 's/^ //' <<EndHelp
Usage: $oneline_usage
Actions:
add|a "THING I NEED TO DO +project @context"
addto DEST "TEXT TO ADD"
append|app NUMBER "TEXT TO APPEND"
archive
command [ACTIONS]
del|rm NUMBER [TERM]
dp|depri NUMBER
do NUMBER
help
list|ls [TERM...]
listall|lsa [TERM...]
listcon|lsc
listfile|lf SRC [TERM...]
listpri|lsp [PRIORITY]
listproj|lsprj
move|mv NUMBER DEST [SRC]
prepend|prep NUMBER "TEXT TO PREPEND"
pri|p NUMBER PRIORITY
replace NUMBER "UPDATED TODO"
report
See "help" for more details.
EndHelp
exit 0
}
help() help()
{ {
@@ -69,6 +100,9 @@ help()
do NUMBER do NUMBER
Marks item on line NUMBER as done in todo.txt. Marks item on line NUMBER as done in todo.txt.
help
Display this help message.
list [TERM...] list [TERM...]
ls [TERM...] ls [TERM...]
Displays all todo's that contain TERM(s) sorted by priority with line Displays all todo's that contain TERM(s) sorted by priority with line
@@ -137,7 +171,7 @@ help()
-f -f
Forces actions without confirmation or interactive input Forces actions without confirmation or interactive input
-h -h
Display this help message Display a short help message
-p -p
Plain mode turns off colors Plain mode turns off colors
-P -P
@@ -260,7 +294,7 @@ do
TODOTXT_FORCE=1 TODOTXT_FORCE=1
;; ;;
h ) h )
help shorthelp
;; ;;
n ) n )
TODOTXT_PRESERVE_LINE_NUMBERS=0 TODOTXT_PRESERVE_LINE_NUMBERS=0
@@ -613,6 +647,9 @@ case $action in
fi fi
cleanup ;; cleanup ;;
"help" )
help
;;
"list" | "ls" ) "list" | "ls" )
shift ## Was ls; new $1 is first search term shift ## Was ls; new $1 is first search term