Browse Source

Smarter args

Signed-off-by: fbt <fbt@fleshless.org>
master
Jack L. Frost 3 months ago
parent
commit
df4e1d0370
1 changed files with 17 additions and 10 deletions
  1. +17
    -10
      ufw

+ 17
- 10
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
upload "$t"
done
else
upload
fi
for t in "${args[@]}"; do
upload "$t"
done
;;

url)
get_token || return $?

for t in "$@"; do
for t in "${args[@]}"; do
get_shortlink "$1"
done
;;


Loading…
Cancel
Save