Skip to content

Commit

Permalink
fu: add -c option
Browse files Browse the repository at this point in the history
  • Loading branch information
xorhash committed May 3, 2019
1 parent d57d313 commit d844d80
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
23 changes: 20 additions & 3 deletions fu
Expand Up @@ -2,10 +2,25 @@
set -e

if test $# -lt 1; then
echo "usage: $0 file" 1>&2
echo "usage: $0 [-c comment] file" 1>&2
exit 1
fi

COMMENTS=""
if test $# -gt 1; then
while test $# -gt 1; do
case "$1" in
-c)
COMMENTS="$2"
shift
shift
;;
*)
echo "$0: unknown option $1" 1>&2
exit 1
esac
done
fi
if test \( ! -r "$1" \) -o \( ! -f "$1" \); then
echo "$0: $1 not a readable file" 1>&2
exit 1
Expand Down Expand Up @@ -57,8 +72,10 @@ else
fi
rm tmpold
NEWLEN=`wc -l tmpnew|awk "{print \\$1 + $OLDLEN - 1}"`
echo "comments? (EOF to end) "
COMMENTS=`cat`
if test -z "$COMMENTS"; then
echo "comments? (EOF to end) "
COMMENTS=`cat`
fi
ed - "$HF" <<EOF
${OLDLEN}-1r tmpnew
\$a
Expand Down
5 changes: 4 additions & 1 deletion fu.1
Expand Up @@ -6,6 +6,7 @@
.Nd update file history
.Sh SYNOPSIS
.Nm
.Op Fl c Ar comment
.Ar file
.Sh DESCRIPTION
The
Expand All @@ -30,7 +31,9 @@ A prompt
is shown on update.
This can be used to indicate information about what changes were
made and why.
No such prompt is shown for the initial revision.
No such prompt is shown for the initial revision or if
.Fl c
with a message is given.
Do not enter a line that that starts with the sequence
.Dq ^AC .
Doing so will break the history file.
Expand Down

0 comments on commit d844d80

Please sign in to comment.