# shellcheck shell=dash

___x_cmd_mac_shutdown(){
    [ $# -gt 0 ]    ||  set -- --normal

    case "$1" in
        -h|--help)      ___x_cmd help -m mac shutdown   ;;
        -y|--yes)       ___x_cmd_mac_shutdown_confirm   ;;
        --normal)       ___x_cmd_mac_shutdown_normal    ;;
        *)              N=mac M="Unknown argument -> $1" log:ret:64 ;;
    esac
}

___x_cmd_mac_shutdown_confirm(){
    ___x_cmd_mac___cmd osascript -e 'tell app "loginwindow" to «event aevtrsdn»'
}

___x_cmd_mac_shutdown_normal(){
    ___x_cmd_mac___cmd osascript -e 'tell app "System Events" to shut down'
}
