From 54028a2a6c01669a807c7297804d938de93b8372 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Thu, 27 Jun 2019 17:26:35 +1000 Subject: [PATCH] message_helper: more "gentele" coding style more consistent quoting --- message_helper | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/message_helper b/message_helper index 48e2428..08b6649 100755 --- a/message_helper +++ b/message_helper @@ -1,35 +1,38 @@ #!/bin/bash # shellcheck source=./common.sh -. "$(dirname "$0")/common.sh" "" +. "$(dirname "$0")/common.sh" '' log="$LOG_FILE" -[ -f merge.log ] && log=merge.log +if [ -f merge.log ]; then + log='merge.log' +fi -branch="" -[ "$1" = "-t" ] && { - branch=$2 +branch= +if [ "$1" = '-t' ]; then + branch="$2" shift 2 -} +fi -kconfig="" -[ "$1" = "-c" ] && { - kconfig=$2 +kconfig= +if [ "$1" = '-c' ]; then + kconfig="$2" shift 2 -} +fi cc='Linux Next Mailing List , Linux Kernel Mailing List ' -[ "$branch" ] || { - branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//') - branch=${branch%%/*} -} +if [ -z "$branch" ]; then + branch=$(grep '^Merging ' "$log" | tail -n 1 | + sed 's/^Merging \([^ /]*\).*$/\1/') +fi contact=$(get_contacts "$branch") -subject="${1//BRANCH/$branch}" +subject=${1//BRANCH/$branch} filter="sed -e 's/BRANCH/$branch/g'" -[ "$kconfig" ] && +if [ "$kconfig" ]; then filter="$filter -e 's/KCONFIG_NAME/$kconfig/g'" +fi filter="$filter | fmt -s" { printf 'Hi all,\n\n'; eval "$filter"; } | -- 2.39.5