diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-03-01 09:36:53 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-03-01 09:36:53 +0200 |
commit | cd43e57b999422980ea95df7f1d03117342e358e (patch) | |
tree | 37afe07c509e7508d8f69edd0fe8793227401023 /bin/ak-comments | |
parent | 4e8f09fcf92eb8de4e39d512ce36b9ed87fbde87 (diff) | |
download | arching-kaos-tools-cd43e57b999422980ea95df7f1d03117342e358e.tar.gz arching-kaos-tools-cd43e57b999422980ea95df7f1d03117342e358e.tar.bz2 arching-kaos-tools-cd43e57b999422980ea95df7f1d03117342e358e.zip |
Simplifying logs
Diffstat (limited to 'bin/ak-comments')
-rwxr-xr-x | bin/ak-comments | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/bin/ak-comments b/bin/ak-comments index e20ab85..add1872 100755 --- a/bin/ak-comments +++ b/bin/ak-comments @@ -1,4 +1,8 @@ #!/bin/bash +PROGRAM="$(basename $0)" +logit(){ + ak-logthis "$PROGRAM" "$1" "$2" +} ZCOMMENTSDIR="$AK_WORKDIR/comments" TEMP="/tmp/aktmp" if [ ! -d $ZCOMMENTSDIR ]; then @@ -6,33 +10,33 @@ if [ ! -d $ZCOMMENTSDIR ]; then cd $ZCOMMENTSDIR ak-logthis "[INFO]" "zcommentsdir created" else - ak-logthis "[INFO]" "zcommentsdir found" + logit "INFO" "zcommentsdir found" fi _ak_modules_comments_create(){ - if [ ! -z $1 ] - then - REFER_TO="$1" - else - ak-logthis "[ERROR]" "No reference given" - echo "[ERROR]" "No reference given" - exit 1 - fi + if [ ! -z $1 ] + then + REFER_TO="$1" + else + logit "ERROR" "No reference given" + echo "ERROR" "No reference given" + exit 1 + fi TEMP="$(ak-tempassin)" cd $TEMP - export COMMENTS_FILE="$(date -u +%s)" - vi $COMMENTS_FILE - echo "Renaming..." - TO_FILE=$COMMENTS_FILE - IPFS_FILE=$(ak-ipfs-add $COMMENTS_FILE) - mv $COMMENTS_FILE $ZCOMMENTSDIR/$TO_FILE - _ak_modules_comments_add $TO_FILE - ak-logthis "[INFO]" "Adding to git repo..." - cd $ZCOMMENTSDIR - if [ ! -z $REFER_TO ] - then - ak-reference create $REFERENCE $REFER_TO - fi + export COMMENTS_FILE="$(date -u +%s)" + vi $COMMENTS_FILE + echo "Renaming..." + TO_FILE=$COMMENTS_FILE + IPFS_FILE=$(ak-ipfs-add $COMMENTS_FILE) + mv $COMMENTS_FILE $ZCOMMENTSDIR/$TO_FILE + _ak_modules_comments_add $TO_FILE + logit "INFO" "Adding to git repo..." + cd $ZCOMMENTSDIR + if [ ! -z $REFER_TO ] + then + ak-reference create $REFERENCE $REFER_TO + fi } _ak_modules_comments_index(){ |