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-reference | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'bin/ak-reference') diff --git a/bin/ak-reference b/bin/ak-reference index ee30ae3..157b797 100755 --- a/bin/ak-reference +++ b/bin/ak-reference @@ -1,16 +1,32 @@ #!/bin/bash +## #TODO +## All you need to know is that there are two options available: +## -h, --help Prints this help message +## index Prints an indexed table of your references files +## import #TODO +## add Creates a data file from the references file you point to +## create [ref] [to] Vim is going to pop up, you will write and save your +## referencesletter and it's going to be saved +fullprogrampath="$(realpath $0)" +PROGRAM=$(basename $0) +descriptionString="Quick description" + + ZREFERENCESDIR="$AK_WORKDIR/references" TEMP="/tmp/aktmp" -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 -echo $ZREFERENCESDIR +source $AK_LIBDIR/_ak_zblock + if [ ! -d $ZREFERENCESDIR ]; then mkdir $ZREFERENCESDIR cd $ZREFERENCESDIR - echo "zreferencesdir created" + logit "INFO" "zreferencesdir created" else - logthis "zreferencesdir found" + logit "INFO" "zreferencesdir found" fi _ak_modules_reference_create(){ @@ -38,6 +54,7 @@ EOF _ak_modules_reference_add $ZREFERENCESDIR/$TO_FILE cd $ZREFERENCESDIR } + _ak_modules_reference_index(){ FILES="$(ls -1 $ZREFERENCESDIR)" i=0 @@ -50,10 +67,7 @@ _ak_modules_reference_index(){ let i+=1 done } -_ak_modules_reference_title(){ - echo ak-references-cli - echo "--------------" -} + _ak_modules_reference_import(){ echo "#TODO" if [ ! -z $1 ] @@ -76,6 +90,7 @@ _ak_modules_reference_import(){ fi exit 224 } + _ak_modules_reference_add(){ TEMP="$(ak-tempassin)" cd $TEMP @@ -102,7 +117,7 @@ EOF cat data | jq -M -c > tmp cat tmp > data rm tmp - ak-zblock-pack "references/add" $(pwd)/data + _ak_zblock_pack "references/add" $(pwd)/data if [ $? != 0 ] then echo "error??" @@ -111,27 +126,14 @@ EOF echo "References added successfully" } -_ak_modules_reference_usage(){ - _ak_modules_reference_title - echo "#TODO" - echo "All you need to know is that there are two options available:" - echo "-h, --help Prints this help message" - echo "index Prints an indexed table of your references files" - echo "import #TODO" - echo "add Creates a data file from the references file you point to" - echo "create [ref] [to] Vim is going to pop up, you will write and save your" - echo " referencesletter and it's going to be saved" - exit 0 -} - if [ ! -z $1 ]; then case $1 in - -h | --help) _ak_modules_reference_usage; exit;; + -h | --help) _ak_usage; exit;; index) _ak_modules_reference_index; exit;; import) _ak_modules_reference_import $2; exit;; add) _ak_modules_reference_add $2; exit;; create) _ak_modules_reference_create $2 $3; exit;; - * ) _ak_modules_reference_usage;; + * ) _ak_usage;; esac -else _ak_modules_reference_usage +else _ak_usage fi -- cgit v1.2.3