# shellcheck shell=dash

___x_cmd_hub_access_unset(){
    local X_help_cmd='___x_cmd_hub___help access unset'
    help:arg-null:parse
    local user=
    while [ $# -gt 0 ]; do
        case "$1" in
            --user)         user="$2"; shift 2 ;;
            *) break ;;
        esac
    done
    local remotefp="$1"; [ -n "$remotefp" ] || M='Provide resource path' N=hub log:ret:64
    [ -n "$user" ] || ___x_cmd ui yesno "Are you sure you want to remove all other users' permissions for $remotefp?" || return
    remotefp="$(___x_cmd_hub_file_normalize_remotefp "$remotefp")"

    local resp=
    resp="$(___x_cmd_hub_u_curl put /api/v0/access/del -- "res=${remotefp}" "username=${user}")" || {
        ___x_cmd_hub_u_handle_resp false "Failed to remove access: "
        return 1
    }
    hub:debug "resp => $resp"
    ___x_cmd_hub_u_handle_resp true "Success to rm access for $remotefp"
}
