First go at args
This commit is contained in:
16
⚡
16
⚡
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user