# HG changeset patch # User Sascha L. Teichmann # Date 1217493911 -7200 # Node ID e7245c2127e5cb337b0e7a43873bd4c89aa34fb1 # Parent 2b2f74f301db69874f842bdf732fb425b41d9f03 Applied patch from Stephan Holl to show usage on '-h' of '--help'. Added check for existence of db file. diff -r 2b2f74f301db -r e7245c2127e5 ChangeLog --- a/ChangeLog Thu Jul 31 01:00:42 2008 +0200 +++ b/ChangeLog Thu Jul 31 10:45:11 2008 +0200 @@ -1,3 +1,8 @@ +2008-07-31 Sascha L. Teichmann + + * contrib/wochenbericht: Applied patch from Stephan Holl to show + usage on '-h' of '--help'. Added check for existence of db file. + 2008-07-31 Sascha L. Teichmann * contrib/wochenbericht: New. Little script to summarize the diff -r 2b2f74f301db -r e7245c2127e5 contrib/wochenbericht --- a/contrib/wochenbericht Thu Jul 31 01:00:42 2008 +0200 +++ b/contrib/wochenbericht Thu Jul 31 10:45:11 2008 +0200 @@ -12,6 +12,20 @@ # This is Free Software in terms of GPLv3 or later. See # LICENSE coming with getan for details. # +usage() { + cat <] [] + defaults to current week + defaults to time.db +EOF + exit 1 +} + +if [ "$1" == "--help" -o "$1" == "-h" ]; then + usage +fi + + if [[ "$1" -eq "" ]]; then WEEK=`date +'%W'` # remove hash below if you want previous week @@ -22,6 +36,11 @@ TIME_DB=${2:-time.db} +if [ ! -f ${TIME_DB} ]; then + echo "error: Database file ${TIME_DB} does not exist." + usage +fi + sqlite3 ${TIME_DB} " SELECT coalesce(description, 'Verschiedenes'), total FROM projects INNER JOIN (