Use getopts helpers in network

This commit is contained in:
Maniack Crudelis 2018-12-29 18:51:21 +01:00 committed by GitHub
parent 8c600e1e0b
commit 43e4a34d21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ ynh_normalize_url_path () {
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
test -n "$path_url" || ynh_die "ynh_normalize_url_path expect a URL path as first argument and received nothing." test -n "$path_url" || ynh_die --message="ynh_normalize_url_path expect a URL path as first argument and received nothing."
if [ "${path_url:0:1}" != "/" ]; then # If the first character is not a / if [ "${path_url:0:1}" != "/" ]; then # If the first character is not a /
path_url="/$path_url" # Add / at begin of path variable path_url="/$path_url" # Add / at begin of path variable
fi fi
@ -40,7 +40,7 @@ ynh_find_port () {
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
test -n "$port" || ynh_die "The argument of ynh_find_port must be a valid port." test -n "$port" || ynh_die --message="The argument of ynh_find_port must be a valid port."
while netcat -z 127.0.0.1 $port # Check if the port is free while netcat -z 127.0.0.1 $port # Check if the port is free
do do
port=$((port+1)) # Else, pass to next port port=$((port+1)) # Else, pass to next port