_print_usage() {
echo "Usage: ${BIN_NAME} COMMAND"
+ echo "Usage: ${BIN_NAME} COMMAND TARGET"
echo "Wrapper around certain borgbackup usages.\n"
echo "Available commands:\n"
+ _var_of() { eval printf '"%s"' '"${'"${1}${2}"'}"'; }
_build_index() {
- _INDEX=" ${_CMD}$(eval printf '"%s"' '"${HELP_ARGS_'${_CMD}'}"')"
- _LEN_INDEX=$(echo -n "${_INDEX}" | wc -c)
+ _INDEX=" ${_CMD}$(_var_of 'HELP_ARGS_' ${_CMD})"
+ _LEN_INDEX=$(echo -n "${_INDEX}" | wc -c)
}
_MAX_LEN_INDEX=0
for _CMD in ${COMMANDS}; do
_build_index
- if [ "${_LEN_INDEX}" -gt "${_MAX_LEN_INDEX}" ]; then
+ if [ "${_LEN_INDEX}" -gt "${_MAX_LEN_INDEX}" ]; then
_MAX_LEN_INDEX="${_LEN_INDEX}"
fi
done
_build_index
printf '%s' "${_INDEX}"
_LEN_GAP=$(calc "${_MAX_LEN_INDEX} - ${_LEN_INDEX} + 2")
- for _ in $(seq 1 ${_LEN_GAP}); do
+ for _ in $(seq 1 ${_LEN_GAP}); do
printf ' '
done
- eval printf '"%s\n"' '"${HELP_DESC_'${_CMD}'}"'
+ printf '%s\n' "$(_var_of 'HELP_DESC_' ${_CMD})"
done
}
done < "${_PATH_PIPE}"
rm "${_PATH_PIPE}"
if [ -z "${_REPO}" ]; then
- error_exit "no repo being available."
+ error_exit 'no repo being available.'
fi
# determine passphrase and archive
# parse args to execution
if [ "$#" -lt 1 ]; then
- error_exit_with_usage "missing command."
+ error_exit_with_usage 'missing command.'
fi
for CMD in ${COMMANDS}; do
if [ "$1" = "${CMD}" ]; then