aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-profile
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ak-profile')
-rwxr-xr-xbin/ak-profile59
1 files changed, 33 insertions, 26 deletions
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 <data> Show profile entry from specified DATA IPFS CIDv0
+##
+## set <property> <value> Sets a profile value
+##
+## get <property> Gets a profile value from the on-disk file.
+##
+## Advanced (use with caution may produce duplicate entries):
+##
+## add <file> Creates a data file from the profile file you point
+## to (file should already be in ZPROFILEDIR.
+##
+## import <folder> 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 <data> Show profile entry from specified DATA IPFS CIDv0"
- echo " set <property> <value> Sets a profile value"
- echo " get <property> Gets a profile value from the on-disk file."
- echo ""
- echo "Advanced (use with caution may produce duplicate entries):"
- echo " add <file> Creates a data file from the profile file you point"
- echo " to (file should already be in ZPROFILEDIR."
- echo " import <folder> 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