diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-03-31 12:00:59 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-03-31 12:00:59 +0300 |
commit | e4f18be94261b39544ef3bc50321f6aedeb45bd6 (patch) | |
tree | 2c79daf0bdc91beb91846f00bb3d3f51236967cf /bin/ak-reference | |
parent | 23a61661f03c03a357ad8aa47ba3595fabe24de1 (diff) | |
download | arching-kaos-tools-e4f18be94261b39544ef3bc50321f6aedeb45bd6.tar.gz arching-kaos-tools-e4f18be94261b39544ef3bc50321f6aedeb45bd6.tar.bz2 arching-kaos-tools-e4f18be94261b39544ef3bc50321f6aedeb45bd6.zip |
huge refactor, might breaking things
Diffstat (limited to 'bin/ak-reference')
-rwxr-xr-x | bin/ak-reference | 52 |
1 files changed, 27 insertions, 25 deletions
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 <file> #TODO +## add <file> 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 <file> #TODO" - echo "add <file> 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 |