From 5bd33d6a594eea95681716380c816c7c06e79905 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Wed, 23 Nov 2022 12:14:51 +0100 Subject: [PATCH] sequencer - fix -c opening config file twice if not existent before LOG_TIME stamp in local time --- sequencer.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sequencer.sh b/sequencer.sh index 9b007ea..0694d03 100755 --- a/sequencer.sh +++ b/sequencer.sh @@ -35,6 +35,7 @@ set -o pipefail readonly seq_origin="$(cd -- "$(dirname -- "$(readlink -f -- "${0}")")" && pwd)" readonly seq_file=$(basename -- "${0}") readonly seq_fileName=${seq_file%%.*} + readonly seq_self="${seq_origin}/${seq_file}" # shellcheck disable=SC2015 # && || is not if else readonly seq_invocation="$(printf '%q' "${0}")$( (($#)) && printf ' %q' "$@" || true)" readonly seq_template="seqTemplate.sh" @@ -436,9 +437,9 @@ USAGE_API if ! (( direct )) ; then if [[ -n "${LOG_TIME}" ]] ; then if (( appendText )) ; then - printf '%24s' "" >${outp} + printf '%19s' "" >${outp} else - printf '%s ' "$(date -u +"%Y-%m-%d %H:%M:%S UTC")" >${outp} + printf '%s' "$(date +"%Y-%m-%d %H:%M:%S")" >${outp} fi fi @@ -446,7 +447,7 @@ USAGE_API printf " %3s " "[${log_level}]" >${outp} printf "%s" "${log_line}" >${outp} else - # +3 : "[] " + # +4 : " [] " printf "%$((${#log_level} + 4))s%s" "" "${log_line}" >${outp} fi else @@ -1300,7 +1301,8 @@ initSeqConfig() { if [ $retVal -eq 255 ]; then error "No seq configuration created" retVal=3 - elif ! quiet && ! dry ; then + elif interactive && ! dry && (( ! _seq_configEdit )) ; then + # ! _seq_configEdit : Edit operation will be performed in main if confirm "Edit configuration file now?" ; then exe editor "$configLoc" . "$configLoc" @@ -1623,10 +1625,10 @@ sqr::main() { # Create/edit configuration file if (( _seq_configEdit )) ; then - # Suppress seq_config output for editing + # Suppress seq_config output for editing and allow it to fail quietSave=${LOG_LEVEL} LOG_LEVEL=0 - seq_config "${seq_args[@]}" + seq_config "${seq_args[@]}" || true LOG_LEVEL=${quietSave} if [ -w "$seq_configFile" ]; then exe editor "$seq_configFile"