Faster here document outputs. (Help/Usage messages)

This commit is contained in:
Jared Cordasco
2010-01-05 15:22:13 -05:00
parent d337933fd9
commit acc881f0dd

335
todo.sh
View File

@@ -4,16 +4,17 @@
# Place the .todo/config file in your home directory or use the -d option for a custom location. # Place the .todo/config file in your home directory or use the -d option for a custom location.
[ -f VERSION-FILE ] && . VERSION-FILE || VERSION="@DEV_VERSION@" [ -f VERSION-FILE ] && . VERSION-FILE || VERSION="@DEV_VERSION@"
version() { sed -e 's/^ //' <<EndVersion version() {
TODO.TXT Command Line Interface v$VERSION cat <<-EndVersion
TODO.TXT Command Line Interface v$VERSION
First release: 5/11/2006 First release: 5/11/2006
Original conception by: Gina Trapani (http://ginatrapani.org) Original conception by: Gina Trapani (http://ginatrapani.org)
Contributors: http://github.com/ginatrapani/todo.txt-cli/network Contributors: http://github.com/ginatrapani/todo.txt-cli/network
License: GPL, http://www.gnu.org/copyleft/gpl.html License: GPL, http://www.gnu.org/copyleft/gpl.html
More information and mailing list at http://todotxt.com More information and mailing list at http://todotxt.com
Code repository: http://github.com/ginatrapani/todo.txt-cli/tree/master Code repository: http://github.com/ginatrapani/todo.txt-cli/tree/master
EndVersion EndVersion
exit 1 exit 1
} }
@@ -26,202 +27,202 @@ oneline_usage="$TODO_SH [-fhpantvV] [-d todo_config] action [task_number] [task_
usage() usage()
{ {
sed -e 's/^ //' <<EndUsage cat <<-EndUsage
Usage: $oneline_usage Usage: $oneline_usage
Try '$TODO_SH -h' for more information. Try '$TODO_SH -h' for more information.
EndUsage EndUsage
exit 1 exit 1
} }
shorthelp() shorthelp()
{ {
sed -e 's/^ //' <<EndHelp cat <<-EndHelp
Usage: $oneline_usage Usage: $oneline_usage
Actions: Actions:
add|a "THING I NEED TO DO +project @context" add|a "THING I NEED TO DO +project @context"
addto DEST "TEXT TO ADD" addto DEST "TEXT TO ADD"
addm "THINGS I NEED TO DO addm "THINGS I NEED TO DO
MORE THINGS I NEED TO DO" MORE THINGS I NEED TO DO"
append|app NUMBER "TEXT TO APPEND" append|app NUMBER "TEXT TO APPEND"
archive archive
command [ACTIONS] command [ACTIONS]
del|rm NUMBER [TERM] del|rm NUMBER [TERM]
dp|depri NUMBER dp|depri NUMBER
do NUMBER do NUMBER
help help
list|ls [TERM...] list|ls [TERM...]
listall|lsa [TERM...] listall|lsa [TERM...]
listcon|lsc listcon|lsc
listfile|lf SRC [TERM...] listfile|lf SRC [TERM...]
listpri|lsp [PRIORITY] listpri|lsp [PRIORITY]
listproj|lsprj listproj|lsprj
move|mv NUMBER DEST [SRC] move|mv NUMBER DEST [SRC]
prepend|prep NUMBER "TEXT TO PREPEND" prepend|prep NUMBER "TEXT TO PREPEND"
pri|p NUMBER PRIORITY pri|p NUMBER PRIORITY
replace NUMBER "UPDATED TODO" replace NUMBER "UPDATED TODO"
report report
See "help" for more details. See "help" for more details.
EndHelp EndHelp
exit 0 exit 0
} }
help() help()
{ {
sed -e 's/^ //' <<EndHelp cat <<-EndHelp
Usage: $oneline_usage Usage: $oneline_usage
Actions: Actions:
add "THING I NEED TO DO +project @context" add "THING I NEED TO DO +project @context"
a "THING I NEED TO DO +project @context" a "THING I NEED TO DO +project @context"
Adds THING I NEED TO DO to your todo.txt file on its own line. Adds THING I NEED TO DO to your todo.txt file on its own line.
Project and context notation optional. Project and context notation optional.
Quotes optional. Quotes optional.
addm "FIRST THING I NEED TO DO +project1 @context addm "FIRST THING I NEED TO DO +project1 @context
SECOND THING I NEED TO DO +project2 @context" SECOND THING I NEED TO DO +project2 @context"
Adds FIRST THING I NEED TO DO to your todo.txt on its own line and Adds FIRST THING I NEED TO DO to your todo.txt on its own line and
Adds SECOND THING I NEED TO DO to you todo.txt on its own line. Adds SECOND THING I NEED TO DO to you todo.txt on its own line.
Project and context notation optional. Project and context notation optional.
Quotes optional. Quotes optional.
addto DEST "TEXT TO ADD" addto DEST "TEXT TO ADD"
Adds a line of text to any file located in the todo.txt directory. Adds a line of text to any file located in the todo.txt directory.
For example, addto inbox.txt "decide about vacation" For example, addto inbox.txt "decide about vacation"
append NUMBER "TEXT TO APPEND" append NUMBER "TEXT TO APPEND"
app NUMBER "TEXT TO APPEND" app NUMBER "TEXT TO APPEND"
Adds TEXT TO APPEND to the end of the todo on line NUMBER. Adds TEXT TO APPEND to the end of the todo on line NUMBER.
Quotes optional. Quotes optional.
archive archive
Moves done items from todo.txt to done.txt and removes blank lines. Moves done items from todo.txt to done.txt and removes blank lines.
command [ACTIONS] command [ACTIONS]
Runs the remaining arguments using only todo.sh builtins. Runs the remaining arguments using only todo.sh builtins.
Will not call any .todo.actions.d scripts. Will not call any .todo.actions.d scripts.
del NUMBER [TERM] del NUMBER [TERM]
rm NUMBER [TERM] rm NUMBER [TERM]
Deletes the item on line NUMBER in todo.txt. Deletes the item on line NUMBER in todo.txt.
If term specified, deletes only the term from the line. If term specified, deletes only the term from the line.
depri NUMBER depri NUMBER
dp NUMBER dp NUMBER
Deprioritizes (removes the priority) from the item Deprioritizes (removes the priority) from the item
on line NUMBER in todo.txt. on line NUMBER in todo.txt.
do NUMBER[, NUMBER, NUMBER, ...] do NUMBER[, NUMBER, NUMBER, ...]
Marks item(s) on line NUMBER as done in todo.txt. Marks item(s) on line NUMBER as done in todo.txt.
help help
Display this help message. 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
numbers. If no TERM specified, lists entire todo.txt. numbers. If no TERM specified, lists entire todo.txt.
listall [TERM...] listall [TERM...]
lsa [TERM...] lsa [TERM...]
Displays all the lines in todo.txt AND done.txt that contain TERM(s) Displays all the lines in todo.txt AND done.txt that contain TERM(s)
sorted by priority with line numbers. If no TERM specified, lists sorted by priority with line numbers. If no TERM specified, lists
entire todo.txt AND done.txt concatenated and sorted. entire todo.txt AND done.txt concatenated and sorted.
listcon listcon
lsc lsc
Lists all the task contexts that start with the @ sign in todo.txt. Lists all the task contexts that start with the @ sign in todo.txt.
listfile SRC [TERM...] listfile SRC [TERM...]
lf SRC [TERM...] lf SRC [TERM...]
Displays all the lines in SRC file located in the todo.txt directory, Displays all the lines in SRC file located in the todo.txt directory,
sorted by priority with line numbers. If TERM specified, lists sorted by priority with line numbers. If TERM specified, lists
all lines that contain TERM in SRC file. all lines that contain TERM in SRC file.
listpri [PRIORITY] listpri [PRIORITY]
lsp [PRIORITY] lsp [PRIORITY]
Displays all items prioritized PRIORITY. Displays all items prioritized PRIORITY.
If no PRIORITY specified, lists all prioritized items. If no PRIORITY specified, lists all prioritized items.
listproj listproj
lsprj lsprj
Lists all the projects that start with the + sign in todo.txt. Lists all the projects that start with the + sign in todo.txt.
move NUMBER DEST [SRC] move NUMBER DEST [SRC]
mv NUMBER DEST [SRC] mv NUMBER DEST [SRC]
Moves a line from source text file (SRC) to destination text file (DEST). Moves a line from source text file (SRC) to destination text file (DEST).
Both source and destination file must be located in the directory defined Both source and destination file must be located in the directory defined
in the configuration directory. When SRC is not defined in the configuration directory. When SRC is not defined
it's by default todo.txt. it's by default todo.txt.
prepend NUMBER "TEXT TO PREPEND" prepend NUMBER "TEXT TO PREPEND"
prep NUMBER "TEXT TO PREPEND" prep NUMBER "TEXT TO PREPEND"
Adds TEXT TO PREPEND to the beginning of the todo on line NUMBER. Adds TEXT TO PREPEND to the beginning of the todo on line NUMBER.
Quotes optional. Quotes optional.
pri NUMBER PRIORITY pri NUMBER PRIORITY
p NUMBER PRIORITY p NUMBER PRIORITY
Adds PRIORITY to todo on line NUMBER. If the item is already Adds PRIORITY to todo on line NUMBER. If the item is already
prioritized, replaces current priority with new PRIORITY. prioritized, replaces current priority with new PRIORITY.
PRIORITY must be an uppercase letter between A and Z. PRIORITY must be an uppercase letter between A and Z.
replace NUMBER "UPDATED TODO" replace NUMBER "UPDATED TODO"
Replaces todo on line NUMBER with UPDATED TODO. Replaces todo on line NUMBER with UPDATED TODO.
report report
Adds the number of open todo's and closed done's to report.txt. Adds the number of open todo's and closed done's to report.txt.
Options: Options:
-@ -@
Hide context names in list output. Use twice to show context Hide context names in list output. Use twice to show context
names (default). names (default).
-+ -+
Hide project names in list output. Use twice to show project Hide project names in list output. Use twice to show project
names (default). names (default).
-d CONFIG_FILE -d CONFIG_FILE
Use a configuration file other than the default ~/.todo/config Use a configuration file other than the default ~/.todo/config
-f -f
Forces actions without confirmation or interactive input Forces actions without confirmation or interactive input
-h -h
Display a short help message Display a short help message
-p -p
Plain mode turns off colors Plain mode turns off colors
-P -P
Hide priority labels in list output. Use twice to show Hide priority labels in list output. Use twice to show
priority labels (default). priority labels (default).
-a -a
Don't auto-archive tasks automatically on completion Don't auto-archive tasks automatically on completion
-n -n
Don't preserve line numbers; automatically remove blank lines Don't preserve line numbers; automatically remove blank lines
on task deletion on task deletion
-t -t
Prepend the current date to a task automatically Prepend the current date to a task automatically
when it's added. when it's added.
-v -v
Verbose mode turns on confirmation messages Verbose mode turns on confirmation messages
-vv -vv
Extra verbose mode prints some debugging information Extra verbose mode prints some debugging information
-V -V
Displays version, license and credits Displays version, license and credits
-x -x
Disables TODOTXT_FINAL_FILTER Disables TODOTXT_FINAL_FILTER
Environment variables: Environment variables:
TODOTXT_AUTO_ARCHIVE=0 is same as option -a TODOTXT_AUTO_ARCHIVE=0 is same as option -a
TODOTXT_CFG_FILE=CONFIG_FILE is same as option -d CONFIG_FILE TODOTXT_CFG_FILE=CONFIG_FILE is same as option -d CONFIG_FILE
TODOTXT_FORCE=1 is same as option -f TODOTXT_FORCE=1 is same as option -f
TODOTXT_PRESERVE_LINE_NUMBERS=0 is same as option -n TODOTXT_PRESERVE_LINE_NUMBERS=0 is same as option -n
TODOTXT_PLAIN=1 is same as option -p TODOTXT_PLAIN=1 is same as option -p
TODOTXT_DATE_ON_ADD=1 is same as option -t TODOTXT_DATE_ON_ADD=1 is same as option -t
TODOTXT_VERBOSE=1 is same as option -v TODOTXT_VERBOSE=1 is same as option -v
TODOTXT_DEFAULT_ACTION="" run this when called with no arguments TODOTXT_DEFAULT_ACTION="" run this when called with no arguments
TODOTXT_SORT_COMMAND="sort ..." customize list output TODOTXT_SORT_COMMAND="sort ..." customize list output
TODOTXT_FINAL_FILTER="sed ..." customize list after color, P@+ hiding TODOTXT_FINAL_FILTER="sed ..." customize list after color, P@+ hiding
EndHelp EndHelp
if [ -d "$TODO_ACTIONS_DIR" ] if [ -d "$TODO_ACTIONS_DIR" ]
then then