#!/usr/local/bin/bash ############################################################### # parse the command line, and call the appropriate executable # # # ############################################################### function helpq () { echo "Syntax: $0 [options]" echo " General Options:" echo " [-f|--home ] set QHACC_HOME" echo " [-w|--warranty] print warranty information" echo " [--gui] force GUI initialization" echo " [--cli] force CLI initialization" echo " [--version] print version information" echo echo " Command-Line Options:" echo " [--debug ] set debugging output" echo " [--archive :]" echo " archive transactions" echo " [--restore ] restore transactions" echo " [--report ] reports" echo " [--export ] export data to directory" echo " [--import ] import data from directory" echo " [--create ] make a QHACC_HOME creation script" echo " [--verifydb] verify database integrity" echo " [--fixdb] fix database integrity" echo " [--plugins] list available plugins" echo echo " GUI Options:" echo " [--debug ] set debugging output" echo " [-l ] set QHacc Locale Directory" exit 1 } prefix=@prefix@ exec_prefix=@exec_prefix@ PATH=@bindir@:$PATH # You can change QHACC_ROOT and QHACC_HOME to fit your needs QHACC_ROOT=${QHACC_ROOT:="@libdir@"} QHACC_HOME=${QHACC_HOME:="${HOME}/.qhacc"} QHACC_LANGDIR=${QHACC_LANGDIR:="@datadir@/qhacc"} export LD_LIBRARY_PATH=$QHACC_ROOT:$LD_LIBRARY_PATH typeset USEGUI="YES" typeset OPTIONS="" typeset LANGFIRST="YES" while [ $# -gt 0 ] do case $1 in "--gui") USEGUI="YES" shift ;; "--cli") USEGUI="NO" shift ;; "-f" | "--home") shift if [ $# -lt 1 ] ; then helpq; fi QHACC_HOME="$1" shift ;; "--accounts") OPTIONS="$OPTIONS --report ACCT:" shift USEGUI="NO" ;; "--plugins") OPTIONS="$OPTIONS --plugins" LANGFIRST="NO" shift USEGUI="NO" ;; "--mbudget") OPTIONS="$OPTIONS --report MBUDGET:" shift USEGUI="NO" ;; "--debug") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --debug $1" shift ;; "--reconcile") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --reconcile $1" shift USEGUI="NO" LANGFIRST="NO" ;; "--preport") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --report PAYEE:$1" shift USEGUI="NO" ;; "--breport") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --report BALS:$1" shift USEGUI="NO" ;; "--dreport") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --report DELTAS:$1" shift USEGUI="NO" ;; "--areport") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --report AVES:$1" shift USEGUI="NO" ;; "--lreport") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --report PFLS:$1" shift USEGUI="NO" ;; "--report") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --report $1" shift USEGUI="NO" ;; "--budget") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --report BUDGET:$1" shift USEGUI="NO" ;; "--transactions") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --report TRANS:$1" shift USEGUI="NO" ;; "--journal") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --report JOURNAL:$1" shift USEGUI="NO" ;; "--export") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --export $1" shift USEGUI="NO" ;; "--import") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --import $1" shift USEGUI="NO" ;; "--archive") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --export ARC:$1" shift USEGUI="NO" ;; "--restore") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --import ARC:$1" shift USEGUI="NO" ;; "--create") shift if [ $# -lt 1 ] ; then helpq; fi OPTIONS="$OPTIONS --create $1" shift USEGUI="NO" ;; "--verifydb") shift OPTIONS="$OPTIONS --verifydb" USEGUI="NO" ;; "--fixdb") shift OPTIONS="$OPTIONS --fixdb" USEGUI="NO" ;; "-l") shift if [ $# -lt 1 ] ; then helpq; fi QHACC_LANGDIR="$1" USEGUI="YES" shift ;; "-w" | "--warranty") cat < QHacc comes with ABSOLUTELY NO WARRANTY; for details type \`qhacc -w'. This is free software, and you are welcome to redistribute it under certain conditions; Please see the GNU Public License for details. EOF exit 0 ;; *) helpq ;; esac done if [ "x$USEGUI" = "xYES" ] then QHACC_ROOT=$QHACC_ROOT QHACC_HOME=$QHACC_HOME qhacc-gui -l $QHACC_LANGDIR $OPTIONS else if [ "X$LANGFIRST" = "xYES" ] then QHACC_ROOT=$QHACC_ROOT QHACC_HOME=$QHACC_HOME qhacc-cli -l $QHACC_LANGDIR $OPTIONS else QHACC_ROOT=$QHACC_ROOT QHACC_HOME=$QHACC_HOME qhacc-cli $OPTIONS -l $QHACC_LANGDIR fi fi