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
}
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()
{
@@ -69,6 +100,9 @@ help()
do NUMBER
Marks item on line NUMBER as done in todo.txt.
help
Display this help message.
list [TERM...]
ls [TERM...]
Displays all todo's that contain TERM(s) sorted by priority with line
@@ -137,7 +171,7 @@ help()
-f
Forces actions without confirmation or interactive input
-h
Display this help message
Display a short help message
-p
Plain mode turns off colors
-P
@@ -260,7 +294,7 @@ do
TODOTXT_FORCE=1
;;
h )
help
shorthelp
;;
n )
TODOTXT_PRESERVE_LINE_NUMBERS=0
@@ -613,6 +647,9 @@ case $action in
fi
cleanup ;;
"help" )
help
;;
"list" | "ls" )
shift ## Was ls; new $1 is first search term