#!/usr/bin/env bash
#===============================================================================
#
# DIRECTORY:
# ---
#
# FILE:
# ./addressbook_plugin.sh
#
# USAGE:
# . addressbook_plugin.sh
# OR
# source addressbook_plugin.sh
#
# DESCRIPTION:
# AddressBook plugin (library) to generate content with simple template engine.
#
# BUGS:
# ---
#
# TESTS:
# - shellcheck -s bash -e SC2034 ./AddressBook_plugin.sh
# - shellcheck -s ksh -e SC2034 ./AddressBook_plugin.sh
# - shellcheck -s dash -e SC2034 ./AddressBook_plugin.sh
#
# AUTHOR:
# Patrick Neumann, patrick@neumannsland.de
#
# COAUTHOR(S):
# Odin Heitmann, odin.heitmann@gmail.com
#
# COMPANY:
# (privately)
#
# VERSION:
# 1.0
#
# LINK TO THE MOST CURRENT VERSION:
# (Sorry, we bet, I'm not allowed to publish it over GitHub!)
#
# CREATED:
# 2018-06-01
#
# COPYRIGHT (C):
# 2018 - Patrick Neumann & Odin Heitmann
#
# LICENSE:
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# WARRANTY:
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see AddressBook.sqlitedb not found
"
error "AddressBook.sqlitedb not found"
readonly ADDRESSBOOK_PERSON="
${ADDRESSBOOK_SQLITE/${IOS_BACKUP}/\/private\/var}
"
# Don't forget to copy write ahead log!
${BIN_CP} "${ADDRESSBOOK_SQLITE}"* "${FOLDER}/"
readonly readonly ADDRESSBOOK_PERSON="$( ${BIN_SQLITE3} -html "${FOLDER}/AddressBook.sqlitedb" \
"SELECT
person.ROWID,
person.First,
person.Middle,
person.Last,
multivalue.value
FROM
ABPerson AS person,
ABMultiValue AS multivalue
WHERE
multivalue.record_id=person.ROWID;" )"
fi
if [ "${DEBUG}" = "on" ] ; then
${BIN_PRINTF} "INFO: addressaook_plugin processed.\\n" 1>&2
fi
}
#-------------------------------------------------------------------------------
# Partial template for hardware information for the simple template engine.
#-------------------------------------------------------------------------------
# SC2034: all "unused" vars are verified!
ADDRESSBOOK_INFORMATION=$( ${BIN_CAT} <<'EOF'
ID | First name | Middle name | Last name | Value |
---|