]> git.ozlabs.org Git - next-scripts/blobdiff - send_email
merge_msg: fix branch handling
[next-scripts] / send_email
index 37e5c349d39eb475f24f84be031ad46f5e3584fa..1c0fc4b0e12ccb114c07d43a93c8f3f90e737be0 100755 (executable)
@@ -1,26 +1,22 @@
 #!/bin/bash
 
-TARGET="$(dirname $0)/../mails"/$(date +"%Y-%m-%d+%s").email
+mail_dir=$(realpath --relative-to=. "$(dirname "$0")/../mails")
+printf -v TARGET '%s/%(i%Y-%m-%d+%s)T.email' "$mail_dir" -1
 
+subject="$1"
+shift
 to="$1"
-cc="$2"
-subject="$3"
+shift
 
-(
-       cat <<EOF
-To: $to
-Cc: $cc
-Subject: $subject
-
-FIXME: Add owner of second tree to To:
-       Add author(s)/SOB of conflicting commits.
-
-EOF
+{
+       printf 'To: %s\n' "$to"
+       printf 'Cc: %s\n' "$@"
+       printf 'Subject: %s\n\n' "$subject"
        cat
-) > $TARGET
+} > "$TARGET"
 
-gvim $TARGET
+gvim "$TARGET"
 
-echo "When you're finished editing you need to send $TARGET"
+printf 'When you are finished editing you need to send %s\n' "$TARGET"
 
 exit 0