Add an help() function and invoke it for `help' subcommand - justdoit - Simpler (but with not all the features) reimplementation todo.txt CLI
 (HTM) hg clone https://bitbucket.org/iamleot/justdoit
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) changeset 7536f8fd1e0fffb7e7d334bcdab2a1fecaef8835
 (DIR) parent 7157f6477bfa22cbe6f85d88ac36aaf88564d5f6
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Sat, 18 Aug 2018 13:52:51 
       
       Add an help() function and invoke it for `help' subcommand
       
       Diffstat:
        t.sh |  36 +++++++++++++++++++++++++++++++++++-
        1 files changed, 35 insertions(+), 1 deletions(-)
       ---
       diff -r 7157f6477bfa -r 7536f8fd1e0f t.sh
       --- a/t.sh      Sat Aug 18 13:38:21 2018 +0200
       +++ b/t.sh      Sat Aug 18 13:52:51 2018 +0200
       @@ -50,6 +50,40 @@
        
        
        #
       +# Print help message and exit
       +#
       +help()
       +{
       +
       +       echo "usage: t add|done|edit|help|list|listall"
       +       echo
       +       echo "a|add entry"
       +       echo "Add the entry \`entry' at the end of the todo.txt file."
       +       echo
       +       echo "d|do|done item"
       +       echo "Mark an item \`item' of todo.txt file as done, moving it in done.txt"
       +       echo "and removing it from todo.txt"
       +       echo
       +       echo "edit"
       +       echo "Open the todo.txt with the \${EDITOR}"
       +       echo
       +       echo "help"
       +       echo "Show an help message"
       +       echo
       +       echo "list [pattern]"
       +       echo "List all todo.txt entries that matches pattern (or all of them"
       +       echo "if no pattern is provided)"
       +       echo
       +       echo "listall [pattern]"
       +       echo "List all done.txt and todo.txt entries that matches pattern (or"
       +       echo "all of them if no pattern is provided)"
       +       echo
       +
       +       exit 1
       +}
       +
       +
       +#
        # Add an entry at the end of a todo.txt file
        #
        add()
       @@ -214,7 +248,7 @@
                       ${EDITOR} "${todo_file}"
                       ;;
               h|help)
       -               usage
       +               help
                       ;;
               l|ls|list)
                       search=$2