Smarter args

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2020-10-03 19:44:19 +03:00
parent b63ae67204
commit df4e1d0370

23
ufw
View File

@ -290,7 +290,7 @@ set_argv() {
unset -v arg opt c
case "$1" in
(--) argv+=( "$1" ); break;;
(--) argv+=( "$1" ); shift; break;;
(--*)
IFS='=' read arg opt <<< "$1"
@ -315,6 +315,10 @@ set_argv() {
esac
shift
done
if (( $# )); then
argv+=( "$@" )
fi
}
main() {
@ -396,11 +400,17 @@ main() {
return 1
;;
*) break;;
*) args+=( "$1" );;
esac
shift
done
# Catch the args after --
if (( $# )); then
args+=( "$@" )
shift
fi
TEMPDIR="$cfg_tmp_dir"
for i in "$cfg_tmp_dir"; do
@ -410,20 +420,17 @@ main() {
case "${action:-upload}" in
upload)
get_token || return $?
(( ${#args[@]} )) || return 1
if (( $# )); then
for t in "$@"; do
for t in "${args[@]}"; do
upload "$t"
done
else
upload
fi
;;
url)
get_token || return $?
for t in "$@"; do
for t in "${args[@]}"; do
get_shortlink "$1"
done
;;