From a240fb231695b3ee79c864dc533b2e262b9f4e94 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 27 May 2024 22:50:00 +0200 Subject: [PATCH] helpers 2.1: use positional args for ynh_normalize_url_path --- helpers/helpers.v2.1.d/string | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/helpers/helpers.v2.1.d/string b/helpers/helpers.v2.1.d/string index 398facec2..7990e2b19 100644 --- a/helpers/helpers.v2.1.d/string +++ b/helpers/helpers.v2.1.d/string @@ -112,8 +112,6 @@ ynh_sanitize_dbid() { # Normalize the url path syntax # -# [internal] -# # Handle the slash at the beginning of path and its absence at ending # Return a normalized url path # @@ -124,16 +122,11 @@ ynh_sanitize_dbid() { # ynh_normalize_url_path /example/ # -> /example # ynh_normalize_url_path / # -> / # -# usage: ynh_normalize_url_path --path_url=path_to_normalize -# | arg: -p, --path_url= - URL path to normalize before using it +# usage: ynh_normalize_url_path path_to_normalize # # Requires YunoHost version 2.6.4 or higher. ynh_normalize_url_path() { - # ============ Argument parsing ============= - local -A args_array=([p]=path_url=) - local path_url - ynh_handle_getopts_args "$@" - # =========================================== + local path_url=$1 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 /