Skip to content

Commit

Permalink
feat: add option to only commit changes
Browse files Browse the repository at this point in the history
- previously, there was only a command to compile the latest entry and
  commit, but there may be scenarios where one does not want to compile
  the latest entry---when working with anthologies, for example.
  • Loading branch information
sanjayankur31 committed May 3, 2022
1 parent 2e0f695 commit d02976c
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions calliope.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ encrypt ()
if [ -f "$1" ]
then
echo "Encrypting $1 with $encryptionId"
$GPG_COMMAND --encrypt --sign -r "$encryptionId" "$1" && rm "$1" -f || exit -1
$GPG_COMMAND --batch --encrypt --sign -r "$encryptionId" "$1" && rm "$1" -f || exit -1
else
echo "File $1 not found"
exit 1
Expand Down Expand Up @@ -254,7 +254,7 @@ decrypt ()
then
echo "Decrypting $1 with $encryptionId"
nongpgfname="$(basename $1 .gpg)"
$GPG_COMMAND --decrypt $1 > "$nongpgfname"
$GPG_COMMAND --batch --decrypt $1 > "$nongpgfname"

else
echo "File is not a GPG encrypted file. Doing nothing."
Expand Down Expand Up @@ -496,6 +496,18 @@ usage ()
commit_message="Test" ./calliope.sh -C
If one is not given, the default is used: "$default_commit_message".
Note that encryption, if enabled, is only done before committing.
So, please remember to commit early and commit often.
-m <commit message>
Commit to repository (but do not compile).
An optional commit message may be given using the commit_message
variable:
commit_message="Test" ./calliope.sh -C
If one is not given, the default is used: "$default_commit_message".
Note that encryption, if enabled, is only done before committing.
So, please remember to commit early and commit often.
-c Compile today's entry
Expand Down Expand Up @@ -546,7 +558,7 @@ if [ "$#" -eq 0 ]; then
exit 0
fi
while getopts "evLltca:A:hp:s:E:V:k:CG:g:x" OPTION
while getopts "evLltca:A:hp:s:E:V:k:CG:g:xm" OPTION
do
case $OPTION in
t)
Expand Down Expand Up @@ -617,6 +629,10 @@ do
commit_changes
exit 0
;;
m)
commit_changes
exit 0
;;
G)
decrypt "$OPTARG"
exit 0
Expand Down

0 comments on commit d02976c

Please sign in to comment.