diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-03-27 03:45:56 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-03-27 03:45:56 +0200 |
commit | abdfe0a5c2a86f19aafe12ae70663ddcf83a6e39 (patch) | |
tree | dce7bee8b783bfd12bdd5e691e1745ca4d0c12da | |
parent | 5c08911132823735801aa70a4e2a23bc3f1c859a (diff) | |
download | arching-kaos-tools-abdfe0a5c2a86f19aafe12ae70663ddcf83a6e39.tar.gz arching-kaos-tools-abdfe0a5c2a86f19aafe12ae70663ddcf83a6e39.tar.bz2 arching-kaos-tools-abdfe0a5c2a86f19aafe12ae70663ddcf83a6e39.zip |
Applying new architecture with lib system
-rwxr-xr-x | bin/ak-articles | 1 | ||||
-rwxr-xr-x | bin/ak-comments | 3 | ||||
-rwxr-xr-x | bin/ak-config | 62 | ||||
-rwxr-xr-x | bin/ak-enter | 13 | ||||
-rwxr-xr-x | bin/ak-fs-get | 1 | ||||
-rwxr-xr-x | bin/ak-mixtapes | 16 | ||||
-rwxr-xr-x | bin/ak-news | 18 | ||||
-rwxr-xr-x | bin/ak-reference | 3 |
8 files changed, 60 insertions, 57 deletions
diff --git a/bin/ak-articles b/bin/ak-articles index 4b76776..363aa7f 100755 --- a/bin/ak-articles +++ b/bin/ak-articles @@ -4,6 +4,7 @@ PROGRAM=$(basename $0) descriptionString="Articles module for Arching Kaos" source $AK_LIBDIR/_ak_logit +source $AK_LIBDIR/_ak_script_description ZARTICLESDIR="$AK_WORKDIR/articles" TEMP="/tmp/aktmp" diff --git a/bin/ak-comments b/bin/ak-comments index 9e26e7d..02486f5 100755 --- a/bin/ak-comments +++ b/bin/ak-comments @@ -1,6 +1,9 @@ #!/bin/bash PROGRAM="$(basename $0)" +descriptionString="Comments module for Arching Kaos" + source $AK_LIBDIR/_ak_logit +source $AK_LIBDIR/_ak_script_description ZCOMMENTSDIR="$AK_WORKDIR/comments" TEMP="/tmp/aktmp" diff --git a/bin/ak-config b/bin/ak-config index 9ccb567..8e2df7b 100755 --- a/bin/ak-config +++ b/bin/ak-config @@ -1,19 +1,24 @@ #!/bin/bash PROGRAM="$(basename $0)" +descriptionString="Arching Kaos Configuration Tool" + +source $AK_LIBDIR/_ak_script_description + _ak_config_title(){ - echo "Arching Kaos Configuration Tool" - echo "===============================" + description } + _ak_config_usage(){ - _ak_config_title - echo "" - echo "Usage: $PROGRAM [ show | publish | get-published ]" - echo "" - echo " show Show current configuration (from FileSystem)" - echo " publish Publish current configuration" - echo " get-published Get published ak-config (from IPFS)" - echo "" - exit 0 + _ak_config_title + echo "" + echo "Usage: $PROGRAM [ -h | --help | show | publish | get-published ]" + echo "" + echo " -h, --help Show this help screen" + echo " show Show current configuration (from FileSystem)" + echo " publish Publish current configuration" + echo " get-published Get published ak-config (from IPFS)" + echo "" + exit 0 } _ak_config_show(){ @@ -23,7 +28,7 @@ _ak_config_show(){ GPG_PUB_KEY=$(ak-ipfs-add $KEY) rm $KEY - echo ' + echo ' { "profile":'$(ak-profile index | jq -cM)', "genesis":"'$(cat $HOME/.arching-kaos/config/zgenesis)'", @@ -34,33 +39,34 @@ _ak_config_show(){ } _ak_config_publish(){ - _ak_config_show | jq -c -M > tmpfile + _ak_config_show | jq -c -M > tmpfile ipfs key list | grep ak-config 2> /dev/null 1>&2 if [ "$?" -ne 0 ] then ipfs key gen ak-config fi - ak-ipfs-name-publish --key=ak-config /ipfs/$(ak-ipfs-add tmpfile) - if [ "$?" != 0 ] - then - echo -e "\033[0;34mError on publishing\033[0;0m\nYour information:\n" - cat tmpfile - exit 1 - fi - rm tmpfile + ak-ipfs-name-publish --key=ak-config /ipfs/$(ak-ipfs-add tmpfile) + if [ "$?" != 0 ] + then + echo -e "\033[0;34mError on publishing\033[0;0m\nYour information:\n" + cat tmpfile + exit 1 + fi + rm tmpfile } _ak_config_published(){ - ak-ipfs-cat $(ak-node-info ipfs) | jq -c + ak-ipfs-cat $(ak-node-info ipfs) | jq -c } if [ ! -z $1 ]; then - case $1 in - show) _ak_config_show;exit;; - publish) _ak_config_publish;exit;; - get-published) _ak_config_published;exit;; - *) _ak_config_usage;exit;; - esac + case $1 in + --help| -h) _ak_config_usage;exit;; + show) _ak_config_show;exit;; + publish) _ak_config_publish;exit;; + get-published) _ak_config_published;exit;; + *) _ak_config_usage;exit;; + esac else _ak_config_usage fi diff --git a/bin/ak-enter b/bin/ak-enter index a6f7a66..fd96231 100755 --- a/bin/ak-enter +++ b/bin/ak-enter @@ -18,11 +18,16 @@ # Logs messages to $LOGSFILE. PROGRAM="$(basename $0)" +descriptionString="Crawl an arching kaos chain" source $AK_LIBDIR/_ak_logit +source $AK_LIBDIR/_ak_script_description -usage(){ - echo "$PROGRAM - Crawl an arching kaos chain" - echo "-----------------------------------" +_ak_enter_title(){ + description +} + +_ak_enter_usage(){ + _ak_enter_title echo "$PROGRAM [-N | --no-verify] [-l | --limit <number>] [zblock]" echo "$PROGRAM [-N | --no-verify] [-l | --limit <number>] -n <zchain>" echo "Usage:" @@ -63,7 +68,7 @@ fromIpns=0 while [ "$#" ]; do case "$1" in -h | --help) - usage + _ak_enter_usage ;; -l | --limit) limit=$2 diff --git a/bin/ak-fs-get b/bin/ak-fs-get index 5959250..556f499 100755 --- a/bin/ak-fs-get +++ b/bin/ak-fs-get @@ -1,4 +1,5 @@ #!/bin/bash +PROGRAM="$(basename $0)" # set -xe if [ -z $1 ] then diff --git a/bin/ak-mixtapes b/bin/ak-mixtapes index bb030b2..2004ccb 100755 --- a/bin/ak-mixtapes +++ b/bin/ak-mixtapes @@ -1,10 +1,18 @@ #!/bin/bash # The following creates a mixtape data message # We can extend it by calling the ak-zblock-pack.sh mixtape/add data ## ORIGINAL LINE +PROGRAM="$(basename $0)" +descriptionString="AK mixtape block creator" +source $AK_LIBDIR/_ak_logit +source $AK_LIBDIR/_ak_script_description _ak_modules_mixtapes_usage(){ _ak_modules_mixtapes_title - echo "$0 - artist title file" + echo "Usage: $0 - artist title file" +} + +_ak_modules_mixtapes_title(){ + description } _ak_modules_mixtapes_specs(){ @@ -43,12 +51,6 @@ EOF } -_ak_modules_mixtapes_title(){ - echo "AK mixtape block creator" - echo "========================" -} - - if [ ! -z $3 ]; then PWD="$(pwd)" diff --git a/bin/ak-news b/bin/ak-news index 5ccc3a9..5dbc847 100755 --- a/bin/ak-news +++ b/bin/ak-news @@ -6,6 +6,7 @@ ZNEWSDIR="$AK_WORKDIR/news" TEMP="/tmp/aktmp" source $AK_LIBDIR/_ak_logit +source $AK_LIBDIR/_ak_script_description if [ ! -d $ZNEWSDIR ]; then mkdir $ZNEWSDIR @@ -60,24 +61,7 @@ _ak_modules_news_index(){ rm temp } -new_line(){ - printf '\n' -} - -description(){ - full_title="$(printf '%s - %s' "$PROGRAM" "$descriptionString")" - delimiter_count=`echo -n $full_title | wc -c` - printf '%s' "$full_title" - new_line - while [ $delimiter_count -gt 0 ] - do - printf '=' - delimiter_count=$(($delimiter_count-1)) - done - new_line -} _ak_modules_news_title(){ -# echo $PROGRAM description } diff --git a/bin/ak-reference b/bin/ak-reference index 4e450e2..390339e 100755 --- a/bin/ak-reference +++ b/bin/ak-reference @@ -1,13 +1,14 @@ #!/bin/bash ZREFERENCESDIR="$AK_WORKDIR/references" TEMP="/tmp/aktmp" +source $AK_LIBDIR/_ak_logit echo $ZREFERENCESDIR if [ ! -d $ZREFERENCESDIR ]; then mkdir $ZREFERENCESDIR cd $ZREFERENCESDIR echo "zreferencesdir created" else - ak-logthis "zreferencesdir found" + logthis "zreferencesdir found" fi _ak_modules_reference_create(){ |