From e4f18be94261b39544ef3bc50321f6aedeb45bd6 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 31 Mar 2024 12:00:59 +0300 Subject: huge refactor, might breaking things --- bin/ak-profile | 59 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 26 deletions(-) (limited to 'bin/ak-profile') diff --git a/bin/ak-profile b/bin/ak-profile index 02a9fe4..74491ef 100755 --- a/bin/ak-profile +++ b/bin/ak-profile @@ -1,12 +1,39 @@ #!/bin/bash -PROGRAM="$(basename $0)" +## +## Indexes, shows, imports, adds, sets and gets values from and to the +## zchain and files. +## +## Usage: +## +## -h, --help Prints this help message +## +## index Show current status +## +## show Show profile entry from specified DATA IPFS CIDv0 +## +## set Sets a profile value +## +## get Gets a profile value from the on-disk file. +## +## Advanced (use with caution may produce duplicate entries): +## +## add Creates a data file from the profile file you point +## to (file should already be in ZPROFILEDIR. +## +## import Import a folder to zchain #TODO +## +fullprogrampath="$(realpath $0)" +PROGRAM=$(basename $0) +descriptionString="Profile module" ZPROFILEDIR="$AK_WORKDIR/profile" TEMP="/tmp/aktmp" # Outputs to log file in the classic format :) -source $AK_LIBDIR/_ak_logit +source $AK_LIBDIR/_ak_log +source $AK_LIBDIR/_ak_script source $AK_LIBDIR/_ak_ipfs source $AK_LIBDIR/_ak_gpg +source $AK_LIBDIR/_ak_zblock # Whatever the command is, we check if $ZPROFILEDIR is there. # If NOT we create it and we change dir there. @@ -169,7 +196,7 @@ EOF exit 2 fi - ak-zblock-pack "profile/add" $(pwd)/data + _ak_zblock_pack "profile/add" $(pwd)/data if [ "$?" -ne 0 ] then echo "error??" @@ -180,37 +207,17 @@ EOF rm -rf "$TEMPASSIN" } -_ak_modules_profile_usage(){ - echo "Usage:" - echo " $PROGRAM command [options]" - echo "" - echo "Indexes, shows, imports, adds, sets and gets values from and to the" - echo "zchain and files." - echo "" - echo " -h, --help Prints this help message" - echo " index Show current status" - echo " show Show profile entry from specified DATA IPFS CIDv0" - echo " set Sets a profile value" - echo " get Gets a profile value from the on-disk file." - echo "" - echo "Advanced (use with caution may produce duplicate entries):" - echo " add Creates a data file from the profile file you point" - echo " to (file should already be in ZPROFILEDIR." - echo " import Import a folder to zchain #TODO" - echo "" - exit 0 -} if [ ! -z $1 ]; then case $1 in - -h | --help) _ak_modules_profile_usage; exit;; + -h | --help) _ak_usage; exit;; index) _ak_modules_profile_index; exit;; show) _ak_modules_profile_show $2; exit;; import) _ak_modules_profile_import $2; exit;; add) _ak_modules_profile_add $2; exit;; set) _ak_modules_profile_propset $2 "$3"; exit;; get) _ak_modules_profile_propget $2; exit;; - * ) _ak_modules_profile_usage;; + * ) _ak_usage;; esac -else _ak_modules_profile_usage +else _ak_usage fi -- cgit v1.2.3