diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-01-12 06:43:34 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-01-12 06:43:34 +0200 |
commit | fcca3cfad1008459b30a09ad245458f83d213806 (patch) | |
tree | 8865612277f57adb896e9d6671e56dce636b1115 | |
parent | 7d137436bf7583ac30628d239fec55bb2f8a4ca5 (diff) | |
download | arching-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
-rwxr-xr-x | bin/ak-news | 17 |
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 |