# shellcheck shell=dash

___x_cmd log init tz

xrc:mod:lib     tz      fz ls __run id loc util xrun

___x_cmd_tz___main(){
    [ "$#" -gt 0 ] || {
        ___x_cmd_tz_xrun
        return
    }

    local op="$1";      shift
    case "$op" in
        abbr|abbr_|name|name_|offset|offset_|ls|fz|loc|id)
                        ___x_cmd_tz_"$op"           "$@" ;;

        i|info)         ___x_cmd_tz_info            "$@" ;;
        --fzhandle)     ___x_cmd_tz_fzhandle        "$@" ;;
        --preparecmd)   ___x_cmd_tz___preparecmd    "$@" ;;
        --|--exec)      ___x_cmd_tz___run           "$@" ;;
        -h|--help)      ___x_cmd help -m tz ;;

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

___x_cmd_tz_info(){
    local x_

    ___x_cmd_tz_abbr_           || return
    local abbr;     abbr="$x_"

    ___x_cmd_tz_name_ --fail    || true
    local name;     name="$x_"

    ___x_cmd_tz_offset_         || return
    local offset;   offset="$x_"

    printf "%-6s : %s\n" Abbr     "$abbr"
    printf "%-6s : %s\n" Name     "$name"
    printf "%-6s : %s\n" Offset   "$offset"

    # # Get the timezone ...
    # if ___x_cmd_tz_loc_get >/dev/null; then
    #     ___x_cmd_tz_loc_run
    # fi
}

___x_cmd_tz___preparecmd(){
    ___x_cmd snap --preparecmd tz
}
