# shellcheck shell=dash
___x_cmd_pwsh_kill(){
    local op="$1"; shift
        case "$op" in
            ps|process) ___x_cmd_pwsh_kill_process "$@" ;;
            -h|--help)  ___x_cmd help -m pwsh kill ;;
            *)          N=pwsh M="Unsupported subcmd => $1" log:ret:64  ;;
        esac
}

___x_cmd_pwsh_kill_process(){
    local cmd="Stop-Process"
    local IS_FORCE=
    while [ $# -gt 0 ]; do
        case "$1" in
            -f|--force)     IS_FORCE=1; shift ;;
            -n|--name)      cmd="${cmd} -Name $2";   shift 2 ;;
            --id)           cmd="${cmd} -Id $2";     shift 2 ;;
            # -inputobject)
            *)             N=pwsh M="sUnsupported subcmsd => $1" log:ret:64  ;;
        esac
    done

    [ -n "$IS_FORCE" ] || ___x_cmd ui yesno "Are you sure to kill process:  $( ___x_cmd ui bold red "$cmd" ) ?" || return $?
    cmd="${cmd} -PassThru -Force"
    ___x_cmd_pwsh_bin -NoProfile -Command "$cmd"
}
