Files
wx/src/base.sh
Christer Warén fbaa5780d9 Refactoring Code
2025-11-10 12:40:35 +02:00

69 lines
954 B
Bash

#!/bin/bash
#if [ ! "$BASH_VERSION" ] ; then
# bash $0 $1 $2 $3 $4 $5 $6 $7 $8 $9
# exit 1
#fi
declare -Ax args
declare -Ax config
declare -Ax messages
{{ FUNCTIONS }}
{{ UI }}
{{ COMMANDS }}
i=1
while [[ "$1" != "" ]]
do
case $1 in
--*)
key="${1%%=*}"
value="${1#*=}"
if [[ "$value" == "$key" ]]
then
shift
value="$1"
fi
if [[ -z $value ]]
then
value=true
fi
args["${key#--}"]="$value"
;;
-*)
key="${1%=*}"
value="${1#*=}"
if [[ "$value" == "$key" ]]
then
shift
value="$1"
fi
if [[ -z $value ]]
then
value=true
fi
args["${key#-}"]="$value"
;;
*)
args["$i"]="${1%%=*}"
i=$((i + 1))
;;
esac
shift
done
if [[ ! -z ${args['1']} ]] && [[ $(type -t wx-${args['1']}) == function ]]
then
wx-${args['1']}
else
wx-welcome
fi
wxi-stop