|
@@ -9,6 +9,27 @@ set -euo pipefail
|
|
ENDKW=ROLLBACK
|
|
ENDKW=ROLLBACK
|
|
DATE="$(date +%Y-%m-%d)"
|
|
DATE="$(date +%Y-%m-%d)"
|
|
STORE=" IS NOT NULL"
|
|
STORE=" IS NOT NULL"
|
|
|
|
+usage(){
|
|
|
|
+ cat <<EOF
|
|
|
|
+Usage: ./${0##*/} [ -d DATE ] [ -s STORE ] [ -r | -c ] < transactions.txn
|
|
|
|
+
|
|
|
|
+Companion script for grocery_transactions.py
|
|
|
|
+
|
|
|
|
+Reads transactions from stdin.
|
|
|
|
+ROLLBACK (-r) is enabled by default
|
|
|
|
+Date is optional and by default is set to current day.
|
|
|
|
+Date and store only affect the display of the transactions.
|
|
|
|
+If store is not set, then all stores are shown for that day.
|
|
|
|
+
|
|
|
|
+Example:
|
|
|
|
+ # load generated transactions with ROLLBACK
|
|
|
|
+ ./${0##*/} -d DATE -s STORE < transactions.txn
|
|
|
|
+ ./${0##*/} -d DATE -s STORE -r < transactions.txn
|
|
|
|
+
|
|
|
|
+ # load generated transactions with COMMIT
|
|
|
|
+ ./${0##*/} -d DATE -s STORE -c < transactions.txn
|
|
|
|
+EOF
|
|
|
|
+}
|
|
while getopts ":crd:s:" options; do
|
|
while getopts ":crd:s:" options; do
|
|
case "${options}" in
|
|
case "${options}" in
|
|
c)
|
|
c)
|
|
@@ -31,27 +52,6 @@ while getopts ":crd:s:" options; do
|
|
esac
|
|
esac
|
|
done
|
|
done
|
|
|
|
|
|
-usage(){
|
|
|
|
- cat <<EOF
|
|
|
|
-Usage: ./${0##*/} [ -d DATE ] [ -s STORE ] [ -r | -c ] < transactions.txn
|
|
|
|
-
|
|
|
|
-Companion script for grocery_transactions.py
|
|
|
|
-
|
|
|
|
-Reads transactions from stdin.
|
|
|
|
-ROLLBACK (-r) is enabled by default
|
|
|
|
-Date is optional and by default is set to current day.
|
|
|
|
-Date and store only affect the display of the transactions.
|
|
|
|
-If store is not set, then all stores are shown for that day.
|
|
|
|
-
|
|
|
|
-Example:
|
|
|
|
- # load generated transactions with ROLLBACK
|
|
|
|
- ./${0##*/} -d DATE -s STORE < transactions.txn
|
|
|
|
- ./${0##*/} -d DATE -s STORE -r < transactions.txn
|
|
|
|
-
|
|
|
|
- # load generated transactions with COMMIT
|
|
|
|
- ./${0##*/} -d DATE -s STORE -c < transactions.txn
|
|
|
|
-EOF
|
|
|
|
-}
|
|
|
|
if [[ -t 0 ]]
|
|
if [[ -t 0 ]]
|
|
then
|
|
then
|
|
usage 1>&2
|
|
usage 1>&2
|