diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2021-02-21 17:40:09 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2021-02-21 17:40:09 -0300 |
commit | a95760dc4b5a4c6985c8babfac05000c7307918f (patch) | |
tree | 248942657275bd6dfea1d47a1dce11c6f63a6925 /tomb-close | |
parent | 635f8de8df667872eab76536e02861171fa63fe4 (diff) | |
download | scripts-a95760dc4b5a4c6985c8babfac05000c7307918f.tar.gz scripts-a95760dc4b5a4c6985c8babfac05000c7307918f.tar.bz2 |
Feat: adds tomb-create
Diffstat (limited to 'tomb-close')
-rwxr-xr-x | tomb-close | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tomb-close b/tomb-close new file mode 100755 index 0000000..3ee08dd --- /dev/null +++ b/tomb-close @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# Close a Tomb. +# + +# Parameters +TOMBS="$HOME/data/tombs" +KEYS="$HOME/.tombs" +BASENAME="`basename $0`" +TOMB="$1" + +# Check +if [ ! -d "$TOMBS" ]; then + echo "error: no cemetery available at $TOMBS" + exit 1 +elif [ -z "$TOMB" ]; then + echo "usage: $BASENAME <tomb>" + echo "available tombs: `ls $TOMBS | xargs basename -a -s .tomb | xargs echo`" + exit 1 +elif [ ! -e "$TOMBS/$TOMB.tomb" ]; then + echo "tomb not found: $TOMBS/$TOMB.tomb" + exit 1 +#elif ! tomb list $TOMB &> /dev/null; then +# echo "tomb $TOMB is already closed" +# exit 1 +fi + +# Dispatch +tomb close $TOMB + +# Annex +if [ -d "$TOMBS/.git/annex" ]; then + ( cd $TOMBS && git annex add $TOMB.tomb ) +fi |