aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-06-24 01:26:03 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-06-24 01:26:03 +0300
commitf493668bd5af77ddd7ffa1a877146d729865bd9d (patch)
treedb263287740a8cda8e5fc111a13c10b0b4b6cd7b
parent1f8d96cbabd235a40645d856b75b412438b0c2bc (diff)
downloadarching-kaos-tools-f493668bd5af77ddd7ffa1a877146d729865bd9d.tar.gz
arching-kaos-tools-f493668bd5af77ddd7ffa1a877146d729865bd9d.tar.bz2
arching-kaos-tools-f493668bd5af77ddd7ffa1a877146d729865bd9d.zip
Refactoring
-rwxr-xr-xbin/ak-find-latest-mined-sblock6
-rwxr-xr-xbin/ak-fs-add1
-rwxr-xr-xbin/ak-template3
-rwxr-xr-xlib/_ak_script4
-rwxr-xr-xmodules/repositories/main.sh18
5 files changed, 16 insertions, 16 deletions
diff --git a/bin/ak-find-latest-mined-sblock b/bin/ak-find-latest-mined-sblock
index effe1bb..74fa919 100755
--- a/bin/ak-find-latest-mined-sblock
+++ b/bin/ak-find-latest-mined-sblock
@@ -21,12 +21,12 @@ further(){
lookfor(){
echo -n $1 | grep -e '[0-9a-f]\{128\}' > /dev/null
- if [ ! $? = 0 ]
+ if [ $? -ne 0 ]
then
_ak_log_error "Oops!!! The argument passed, does not match the regular expression!"
else
counters[$CHAIN_PARENT]="$(expr ${counters[$CHAIN_PARENT]} + 1)"
- if [ ! $? = 0 ]
+ if [ $? -ne 0 ]
then
echo "$1, $counters[$1]"
exit 1
@@ -35,7 +35,7 @@ lookfor(){
# echo "$1 file:"
# cat "$1" | jq
NEXT_TARGET="$(cat "$1" | jq | grep previous | tr -d ' ' | sed -e 's/previous//g; s/[",:]//g;')"
- if [ ! "$NEXT_TARGET" = "" ]
+ if [ -n "$NEXT_TARGET" ]
then
_ak_log_info "Found previous: $NEXT_TARGET"
if [ ! -f "$NEXT_TARGET" ]
diff --git a/bin/ak-fs-add b/bin/ak-fs-add
index 3f48d48..50833ea 100755
--- a/bin/ak-fs-add
+++ b/bin/ak-fs-add
@@ -1,5 +1,4 @@
#!/bin/bash
-#set -x
#
# The concept is bit more complicated now
#
diff --git a/bin/ak-template b/bin/ak-template
index 151d9d7..362b22e 100755
--- a/bin/ak-template
+++ b/bin/ak-template
@@ -20,7 +20,8 @@ example(){
}
# Flags to run
-if [ ! -z $1 ]; then
+if [ ! -z $1 ]
+then
case $1 in
-h | --help) _ak_usage; exit;;
--example) example; exit;;
diff --git a/lib/_ak_script b/lib/_ak_script
index 4dbf34a..e9d7c0e 100755
--- a/lib/_ak_script
+++ b/lib/_ak_script
@@ -64,6 +64,6 @@ _ak_usage(){
}
_ak_not_implemented(){
- _ak_title_description
- printf 'Not implemented: %s\n' "$*"
+ #_ak_title_description
+ _ak_log_error "Not implemented: $*"
}
diff --git a/modules/repositories/main.sh b/modules/repositories/main.sh
index ffda701..55f8076 100755
--- a/modules/repositories/main.sh
+++ b/modules/repositories/main.sh
@@ -6,7 +6,7 @@ REPOSTORE="$HOME/.arching-kaos/repostore"
if [ ! -d $BAREDIR ]; then mkdir $BAREDIR; fi
if [ ! -d $REPODIR ]; then echo "no $REPODIR" && exit; fi
if [ ! -f $REPOSTORE ]; then touch $REPOSTORE; fi
-import(){
+_ak_modules_repositories_import(){
REPOS="$(ls -1 $REPODIR)"
for PROJECT in $REPOS
do
@@ -29,7 +29,7 @@ import(){
done
}
-update(){
+_ak_modules_repositories_update(){
if [ ! -z $1 ]
then
USING="$1"
@@ -89,7 +89,7 @@ append-if-needed(){
fi
}
-add(){
+_ak_modules_repositories_add(){
PROJECT="$1"
PROJECTDIR="$REPODIR/$PROJECT"
BAREGITDIR="$BAREDIR/$PROJECT.git"
@@ -116,7 +116,7 @@ add(){
fi
}
-index(){
+_ak_modules_repositories_index(){
_ak_ipfs_key_list_full | grep -e '\.git'
}
@@ -130,7 +130,7 @@ set-as-profile(){
fi
}
-publish(){
+_ak_modules_repositories_publish(){
if [ ! -z $1 ]
then
echo "Filtering for $1..."
@@ -153,10 +153,10 @@ if [ ! -z $1 ]
then
case $1 in
-h | --help) usage; exit;;
- index) index; exit;;
- add) add "$2"; exit;;
- publish) publish "$2"; exit;;
- update) update "$2"; exit;;
+ index) _ak_modules_repositories_index; exit;;
+ add) _ak_modules_repositories_add "$2"; exit;;
+ publish) _ak_modules_repositories_publish "$2"; exit;;
+ update) _ak_modules_repositories_update "$2"; exit;;
*) echo "No command $1";usage; exit;;
esac
else