aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-news
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-01-12 06:43:34 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-01-12 06:43:34 +0200
commitfcca3cfad1008459b30a09ad245458f83d213806 (patch)
tree8865612277f57adb896e9d6671e56dce636b1115 /bin/ak-news
parent7d137436bf7583ac30628d239fec55bb2f8a4ca5 (diff)
downloadarching-kaos-tools-fcca3cfad1008459b30a09ad245458f83d213806.tar.gz
arching-kaos-tools-fcca3cfad1008459b30a09ad245458f83d213806.tar.bz2
arching-kaos-tools-fcca3cfad1008459b30a09ad245458f83d213806.zip
local-index subcommand enhancment
Figures if files are published already in your zchain
Diffstat (limited to 'bin/ak-news')
-rwxr-xr-xbin/ak-news17
1 files changed, 13 insertions, 4 deletions
diff --git a/bin/ak-news b/bin/ak-news
index c020d1a..1b6ff9b 100755
--- a/bin/ak-news
+++ b/bin/ak-news
@@ -43,14 +43,23 @@ create(){
index(){
FILES="$(ls -1 $ZNEWSDIR)"
i=0
+ ak-get-ipfs-hashes-from-my-zchain | sort | uniq > temp
for FILE in $FILES
do
- DATE=$(echo $FILE | cut -d - -f 1 | awk '{print $1}')
- TITLE=$(head -n 1 $ZNEWSDIR/$FILE)
- IPFS_HASH=$(ak-ipfs-addn $ZNEWSDIR/$FILE)
- echo $i \| $IPFS_HASH \| $DATE \| $TITLE
+ DATE="$(echo $FILE | cut -d - -f 1 | awk '{print $1}')"
+ TITLE="$(head -n 1 $ZNEWSDIR/$FILE)"
+ IPFS_HASH="$(ipfs add -nQ $ZNEWSDIR/$FILE)"
+ ONLINE="Not in zchain"
+ grep "$IPFS_HASH" temp > /dev/null 2>&1
+ if [ $? -eq 0 ]
+ then
+ ONLINE="On zchain"
+ fi
+ printf "%3d | %5s | %52s | %10s | %56s \n"\
+ "$i" "$ONLINE" "$IPFS_HASH" "$DATE" "$TITLE"
let i+=1
done
+ rm temp
}
title(){
echo $PROGRAM