mirror of
https://gitea.invidious.io/iv-org/youtube-utils.git
synced 2024-08-15 00:53:16 +00:00
Use 'exit' instead of 'return' to end script execution
This commit is contained in:
parent
22ecea0128
commit
ffdf371763
1 changed files with 16 additions and 16 deletions
|
@ -67,7 +67,7 @@ query_with_error()
|
||||||
|
|
||||||
if [ -z "$data" ]; then
|
if [ -z "$data" ]; then
|
||||||
echo "Error: $error_message"
|
echo "Error: $error_message"
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "$data"
|
echo "$data"
|
||||||
fi
|
fi
|
||||||
|
@ -114,7 +114,7 @@ while :; do
|
||||||
|
|
||||||
if [ $# -eq 0 ] || is_arg "$1"; then
|
if [ $# -eq 0 ] || is_arg "$1"; then
|
||||||
echo "Error: missing argument after -c/--client"
|
echo "Error: missing argument after -c/--client"
|
||||||
return 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
client_option=$1
|
client_option=$1
|
||||||
|
@ -125,7 +125,7 @@ while :; do
|
||||||
|
|
||||||
if [ $# -eq 0 ] || is_arg "$1"; then
|
if [ $# -eq 0 ] || is_arg "$1"; then
|
||||||
echo "Error: missing argument after -d/--data"
|
echo "Error: missing argument after -d/--data"
|
||||||
return 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
data=$1
|
data=$1
|
||||||
|
@ -136,7 +136,7 @@ while :; do
|
||||||
|
|
||||||
if [ $# -eq 0 ] || is_arg "$1"; then
|
if [ $# -eq 0 ] || is_arg "$1"; then
|
||||||
echo "Error: missing argument after -e/--endpoint"
|
echo "Error: missing argument after -e/--endpoint"
|
||||||
return 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
endpoint_option=$1
|
endpoint_option=$1
|
||||||
|
@ -144,7 +144,7 @@ while :; do
|
||||||
|
|
||||||
-h|--help)
|
-h|--help)
|
||||||
print_help
|
print_help
|
||||||
return 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-i|--interactive)
|
-i|--interactive)
|
||||||
|
@ -156,7 +156,7 @@ while :; do
|
||||||
|
|
||||||
if [ $# -eq 0 ] || is_arg "$1"; then
|
if [ $# -eq 0 ] || is_arg "$1"; then
|
||||||
echo "Error: missing argument after -o/--output"
|
echo "Error: missing argument after -o/--output"
|
||||||
return 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
output="$1"
|
output="$1"
|
||||||
|
@ -164,7 +164,7 @@ while :; do
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Error: unknown argument '$1'"
|
echo "Error: unknown argument '$1'"
|
||||||
return 2
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -180,26 +180,26 @@ if [ ! -z "$data" ]; then
|
||||||
# Can't pass data in interactive mode
|
# Can't pass data in interactive mode
|
||||||
if [ $interactive = true ]; then
|
if [ $interactive = true ]; then
|
||||||
echo "Error: -d/--data can't be used with -i/--interactive"
|
echo "Error: -d/--data can't be used with -i/--interactive"
|
||||||
return 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Can't pass client in non-interactive mode (must be part of data)
|
# Can't pass client in non-interactive mode (must be part of data)
|
||||||
if [ ! -z "$client_option" ]; then
|
if [ ! -z "$client_option" ]; then
|
||||||
echo "Error: -c/--client can't be used with -d/--data"
|
echo "Error: -c/--client can't be used with -d/--data"
|
||||||
return 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Endpoint must be given if non-interactive mode
|
# Endpoint must be given if non-interactive mode
|
||||||
if [ -z "$endpoint_option" ]; then
|
if [ -z "$endpoint_option" ]; then
|
||||||
echo "Error: In non-interactive mode, an endpoint must be passed with -e/--endpoint"
|
echo "Error: In non-interactive mode, an endpoint must be passed with -e/--endpoint"
|
||||||
return 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$data" ] && [ $interactive = false ]; then
|
if [ -z "$data" ] && [ $interactive = false ]; then
|
||||||
# Data must be given if non-interactive mode
|
# Data must be given if non-interactive mode
|
||||||
echo "Error: In non-interactive mode, data must be passed with -d/--data"
|
echo "Error: In non-interactive mode, data must be passed with -d/--data"
|
||||||
return 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$output" ] && [ $interactive = true ]; then
|
if [ -z "$output" ] && [ $interactive = true ]; then
|
||||||
|
@ -210,7 +210,7 @@ if [ -z "$output" ] && [ $interactive = true ]; then
|
||||||
|
|
||||||
case $confirm in
|
case $confirm in
|
||||||
[Yy]|[Yy][Ee][Ss]) ;;
|
[Yy]|[Yy][Ee][Ss]) ;;
|
||||||
*) return 0;;
|
*) exit 0;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ fi
|
||||||
case $client_option in
|
case $client_option in
|
||||||
help)
|
help)
|
||||||
print_clients
|
print_clients
|
||||||
return 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
web)
|
web)
|
||||||
|
@ -263,7 +263,7 @@ case $client_option in
|
||||||
echo "Error: Unknown client '$client_option'"
|
echo "Error: Unknown client '$client_option'"
|
||||||
echo ""
|
echo ""
|
||||||
print_clients
|
print_clients
|
||||||
return 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ fi
|
||||||
case $endpoint_option in
|
case $endpoint_option in
|
||||||
help)
|
help)
|
||||||
print_endpoints
|
print_endpoints
|
||||||
return 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
browse)
|
browse)
|
||||||
|
@ -345,7 +345,7 @@ case $endpoint_option in
|
||||||
echo "Error: Unknown endpoint '$endpoint_option'"
|
echo "Error: Unknown endpoint '$endpoint_option'"
|
||||||
echo ""
|
echo ""
|
||||||
print_clients
|
print_clients
|
||||||
return 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue