First go at args

This commit is contained in:
2023-03-05 19:08:55 -08:00
parent b62ef700f4
commit c7be3223b4
4 changed files with 89 additions and 1 deletions

16
View File

@@ -9,6 +9,7 @@ main() {
if [[ $(type -t "⚡${1:-}") == "function" ]]; then
command="$1"
shift
_task_args=( "$@" )
⚡$command "$@"
else
⚡help
@@ -53,6 +54,21 @@ _help-line() {
fi
}
_argument() {
for arg in "${_task_args[@]}"; do
key="$(<<< "$arg" cut -d= -f1)"
value="$(<<< "$arg" cut -d= -f2-)"
if [[ "$key" == "$1" ]]; then
declare -g "_arg_$key"="$value"
fi
done
}
_required_argument() {
_argument "$@"
}
_good-message() {
echo -e "\e[32m$@\e[0m"
}