aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.com>2021-12-18 08:52:10 +0200
committerkaotisk <kaotisk@arching-kaos.com>2021-12-18 08:52:10 +0200
commit339a5d4d9cf54519cad92d5c74da9eb3e0ea864a (patch)
tree1d279c7b28b2faf1351bd0a792ddb5cabcda243a
parent606e3bd269fdc2cf687db82c43a5346f8081864f (diff)
downloadarching-kaos-tools-339a5d4d9cf54519cad92d5c74da9eb3e0ea864a.tar.gz
arching-kaos-tools-339a5d4d9cf54519cad92d5c74da9eb3e0ea864a.tar.bz2
arching-kaos-tools-339a5d4d9cf54519cad92d5c74da9eb3e0ea864a.zip
Changes
- exit codes - gpg2 to gpg - break to exit
-rwxr-xr-xbin/news26
1 files changed, 19 insertions, 7 deletions
diff --git a/bin/news b/bin/news
index 910f1cb..bd0bc95 100755
--- a/bin/news
+++ b/bin/news
@@ -46,6 +46,7 @@ title(){
import(){
echo "#TODO"
echo $1
+ exit 224
}
add(){
if [ -f $1 ]; then
@@ -55,7 +56,7 @@ add(){
TITLE=$(head -n 1 $FILE)
FILE_IPFS_HASH=$(ipfs add -q $FILE)
FILE_SIGN_FILE=$FILE".asc"
- gpg2 --detach-sign --sign-with $FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE
+ gpg --detach-sign --sign-with $FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE
FILE_SIGNATURE=$(ipfs add -q $FILE_SIGN_FILE)
cat > data <<EOF
{
@@ -66,9 +67,19 @@ add(){
"detach":"$FILE_SIGNATURE"
}
EOF
- else echo "File $FILE doesn't exist";
+ else
+ echo "File $FILE doesn't exist";
+ exit 2
fi
pack_z_block "news/add" data
+ if [ $? == 0 ]
+ then
+ echo "News added successfully"
+ exit 0
+ else
+ echo "error??"
+ exit 1
+ fi
}
usage(){
echo "#TODO"
@@ -78,15 +89,16 @@ usage(){
echo "import <file> #TODO"
echo "add <file> Creates a data file from the news file you point to"
echo "create Vim is going to pop up, you will write and save your"
- echo " newsletter and it's going to be saved"
+ echo " newsletter and it's going to be saved"
+ exit 0
}
title
if [ ! -z $1 ]; then
case $1 in
- help) usage;exit;;
- index) index;break;;
- import) import $2; break;;
- add) add $2; break;;
+ help) usage; exit;;
+ index) index; exit;;
+ import) import $2; exit;;
+ add) add $2; exit;;
create) create; exit;;
* ) usage;;
esac