improvements

This commit is contained in:
Lukas Wurzinger 2024-12-25 18:22:26 +01:00
parent 040f0def6a
commit 75cb7fc69a
No known key found for this signature in database

16
taft
View file

@ -4,7 +4,7 @@ set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
progname="$0" progname=$0
error() { error() {
for line in "$@"; do for line in "$@"; do
@ -14,16 +14,16 @@ error() {
exit 1 exit 1
} }
opts=$(getopt --options p:P:vc: --longoptions=port:,path:,verbose,compress: --name "$progname" -- "$@") args=$(getopt --options p:P:vc: --longoptions=port:,path:,verbose,compress: --name "$progname" -- "$@")
eval set -- "$opts" eval set -- "$args"
port=1337 port=1337
path=. path=.
tarflags=() tarflags=()
ncflags=() ncflags=()
while true; do while true; do
case "$1" in case $1 in
(-p | --port) (-p | --port)
port=$2 port=$2
shift 2 shift 2
@ -61,7 +61,7 @@ while true; do
esac esac
done done
if [[ $# == 0 ]]; then if (( $# == 0 )); then
error 'a subcommand is required' error 'a subcommand is required'
fi fi
@ -71,11 +71,11 @@ case $subcommand in
(send) (send)
shift shift
if [[ $# -lt 1 ]]; then if (( $# < 1 )); then
error 'the destination address is required' error 'the destination address is required'
fi fi
if [[ $# -gt 1 ]]; then if (( $# > 1 )); then
error 'too many arguments' error 'too many arguments'
fi fi
@ -86,7 +86,7 @@ case $subcommand in
(recv | receive) (recv | receive)
shift shift
if [[ $# -gt 0 ]]; then if (( $# > 0 )); then
error 'too many arguments' error 'too many arguments'
fi fi