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 | |
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')
-rwxr-xr-x | bin/ak | 30 |
1 files changed, 23 insertions, 7 deletions
@@ -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 |