diff contrib/wochenbericht @ 5:e7245c2127e5

Applied patch from Stephan Holl to show usage on '-h' of '--help'. Added check for existence of db file.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 31 Jul 2008 10:45:11 +0200
parents 2b2f74f301db
children 4de86feae6ac
line wrap: on
line diff
--- 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 <<EOF
+usage: ./wochenbericht [<week of year>] [<getan database file>] 
+    <week of year>        defaults to current week
+    <getan database file> 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 (
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)