ref: e026625830c18a358a485d7c34002d3f853cac55
parent: e7f439aa2ef0f69ccb344be8c3c8971b349d4884
author: Michael Misch <michaelmisch1985@gmail.com>
date: Thu Aug 29 01:05:46 PDT 2024
Fix lossy updates
--- a/task
+++ b/task
@@ -1,22 +1,6 @@
#!/bin/rc -e
rfork ne
-# Remove commentary lines.
-# Remove leading and trailing empty lines.
-# Combine consecutive empty lines between paragraphs.
-# Remove trailing spaces from lines.
-# Ensure there's trailing newline.
-fn cleanmsg{
- awk '
- /^[ ]*#/ {next}
- /^[ ]*$/ {empty = 1; next}
-
- wet && empty {printf "\n"}
- {wet = 1; empty = 0}
- {sub(/[ ]+$/, ""); print $0}
- '
-}
-
fn editmsg{
if(! test -s $msgfile.tmp){
>$msgfile.tmp {
@@ -33,12 +17,6 @@
if(~ $#editor 0)
editor=hold
$editor $msgfile.tmp
-
- cleanmsg < $msgfile.tmp > $msgfile
- if(! test -s $msgfile){
- echo 'empty task message' >[1=2]
- exit 'task'
- }
}
fn gettag{
@@ -50,7 +28,7 @@
}
fn finish{
- cp $msgfile .pro/task/$tag
+ cp $msgfile.tmp .pro/task/$tag
# TODO: . common.rc to set $project, as it's useful for our outputs
#echo '$project:$tag'
}
@@ -57,7 +35,9 @@
fn sigexit{
if(! ~ $#msgfile 0)
- rm -f $msgfile $msgfile.tmp
+ rm -f $msgfile
+ if(! ~ $#msgfile.tmp 0)
+ rm -f $msgfile.tmp
}
flagfmt='c:change change, a:after after, b:before before, e:edit'; args='[msg ...]'