aboutsummaryrefslogtreecommitdiff
path: root/bin/ak
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-03-31 12:00:59 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-03-31 12:00:59 +0300
commite4f18be94261b39544ef3bc50321f6aedeb45bd6 (patch)
tree2c79daf0bdc91beb91846f00bb3d3f51236967cf /bin/ak
parent23a61661f03c03a357ad8aa47ba3595fabe24de1 (diff)
downloadarching-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')
-rwxr-xr-xbin/ak30
1 files changed, 23 insertions, 7 deletions
diff --git a/bin/ak b/bin/ak
index d18012a..add2373 100755
--- a/bin/ak
+++ b/bin/ak
@@ -1,8 +1,14 @@
#!/bin/bash
-
-PROGRAM=$(basename $0)
-source $AK_LIBDIR/_ak_logit
-source $AK_LIBDIR/_ak_script_exit
+##
+## -h, --help Prints this help message
+##
+## Run with no arguments to see available commands
+##
+fullprogrampath="$(realpath $0)"
+PROGRAM="$(basename $0)"
+descriptionString="Arching Kaos CLI"
+source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_script
if [ $# -eq 0 ]
then
@@ -16,18 +22,28 @@ then
if [ -n "$subcmd" ]
then
echo $subcmd | cut -d '-' -f 2 | sort | uniq | sed -e 's/^/ak /g'
- # $(echo $subcmd) $args
+ #$(echo $subcmd) $args
fi
done
) | sort | uniq
exit 1
fi
+if [ $# -eq 1 ]
+then
+ case "$1" in
+ -h|--help)
+ _ak_title_description
+ _ak_help
+ exit 1
+ esac
+fi
+
subcmd="$(echo $* | sed -e 's/ /-/g')"
if [ -f "$AK_BINDIR/ak-$subcmd" ]
then
$(echo ak-$subcmd)
- exit_program $? "ak-$subcmd command finished";
+ _ak_exit_program $? "ak-$subcmd command finished";
else
argc=$#
argv="$*"
@@ -40,7 +56,7 @@ else
then
logit "INFO" "Running: ak-$subcmd with args: $args"
$(echo ak-$subcmd) $args
- exit_program $? "ak-$subcmd command finished";
+ _ak_exit_program $? "ak-$subcmd command finished";
fi
counter=$(($counter + 1))
done