
# disable startupdisk because is (null)

xrc:mod:lib     mac     _pref/ss/attr   _pref/ss/report

___X_CMD_MAC_SS_ATTR='date
time
timezone
usingnetworktime
networktimeserver
computersleep
displaysleep
harddisksleep
wakeonmodem
wakeonnetworkaccess
restartpowerfailure
restartfreeze
allowpowerbuttontosleepcomputer
remotelogin
remoteappleevents
computername
localsubnetname
waitforstartupafterpowerfailure
disablekeyboardwhenenclosurelockisengaged
'

# wrapper for systemsetup
___x_cmd_mac_ss(){
    [ $# -gt 0 ]    ||      set -- report

    local op="$1";  shift
    case "$op" in
        -h|--help)          ___x_cmd help -m mac ss     "$@" ;;

        report)             ___x_cmd_mac_ss_report      "$@" ;;

        tz|timezone)        ___x_cmd_mac_ss_timezone    "$@" ;;
        sdisk|startupdisk)  ___x_cmd_mac_ss_startupdisk "$@" ;;

        attr|time|date)     ___x_cmd_mac_ss_"$op"       "$@" ;;
        *)                  ___x_cmd_mac_ss_attr "$op"  "$@" ;;
    esac
}

___x_cmd_mac_ss_timezone(){
    [ $# -gt 0 ] ||     set -- get

    local op="$1";      shift
    case "$op" in
        ls)         ___x_cmd sudo systemsetup -listtimezones ;;
        get)        ___x_cmd_mac_ss_attr timezone            ;;
        set)        ___x_cmd_mac_ss_attr timezone    "$@" ;;
        -h|--help)  ___x_cmd help -m mac ss timezone "$@" ;;
        *)  N=mac M="Unknown subcmd -> $op" log:ret:64    ;;
    esac
}

___x_cmd_mac_ss_startupdisk(){
    [ $# -gt 0 ] ||     set -- get

    local op="$1";      shift
    case "$op" in
        ls)         ___x_cmd sudo systemsetup -liststartupdisks ;;
        get)        ___x_cmd_mac_ss_attr startupdisk            ;;
        set)        ___x_cmd_mac_ss_attr startupdisk    "$@" ;;
        -h|--help)  ___x_cmd help -m mac ss startupdisk "$@" ;;
        *)  N=mac M="Unknown subcmd -> $op" log:ret:64       ;;
    esac
}

___x_cmd_mac_ss_time(){
    [ $# -gt 0 ] ||     set -- get

    local op="$1";      shift
    case "$op" in
        get)        ___x_cmd_mac_ss_attr time           ;;
        set)        ___x_cmd_mac_ss_attr time      "$@" ;;
        -h|--help)  ___x_cmd help -m mac ss time   "$@" ;;
        *)  N=mac M="Unknown subcmd -> $op" log:ret:64  ;;
    esac
}

___x_cmd_mac_ss_date(){
    [ $# -gt 0 ] ||     set -- get

    local op="$1";      shift
    case "$op" in
        get)        ___x_cmd_mac_ss_attr date           ;;
        set)        ___x_cmd_mac_ss_attr date      "$@" ;;
        -h|--help)  ___x_cmd help -m mac ss date   "$@" ;;
        *)  N=mac M="Unknown subcmd -> $op" log:ret:64  ;;
    esac
}

