# shellcheck shell=dash

___x_cmd log init spf

xrc:mod:lib     spf     load

___x_cmd_spf___main(){
    [ "$#" -gt 0 ] || {
        ___x_cmd_spf___cmd
        return
    }

    local op="$1"; shift
    case "$op" in
        -h|--help)  ___x_cmd help -m spf        "$@" ;;
        *)          ___x_cmd_spf___cmd "$op"    "$@" ;;
    esac
}

___x_cmd_spf___cmd(){
    if ___x_cmd_hascmd spf; then
        ___x_cmd_spf___cmd(){
            RUNEWIDTH_EASTASIAN=0 command spf "$@"
        }
    else
        ___x_cmd_spf___cmd(){
            ___x_cmd_spf_load_env || return
            RUNEWIDTH_EASTASIAN=0 "$___X_CMD_SPF_SHIMAPP_PATH/spf" "$@"
        }
    fi && ___x_cmd_spf___cmd "$@"
}
