# shellcheck shell=dash

___x_cmd log init sleep

xrc:mod:lib     sleep       beacon

___x_cmd_sleep___main(){
    [ $# -gt 0 ]    ||  set -- --help

    local op="$1";      shift
    case "$op" in
        -h|--help)      ___x_cmd help -m sleep;     return 0 ;;
        schd|beacon)    ___x_cmd_sleep_"$op"            "$@" ;;

        /*|,*)          ___x_cmd_sleep_schd   "${op#?}" "$@" ;;

        *)              ___x_cmd_sleep___main1  "$op"   "$@" ;;
    esac
}

___x_cmd_sleep___main1(){
    local x_
    if  ___x_cmd humantime tosec_ "$1"; then
        x:debug "Sleep in seconds: $x_"
        ___x_cmd_cmds_sleep "$x_"
    fi

    [ $# -le 1 ] || {
        shift
        "$@"
    }
}
