

___x_cmd_hn_topic(){
    local topic="${1:-top}";
    case "$topic" in
        -h|--help)      ___x_cmd help -m hn topic ;;
        top|new|best|ask|show|job)
            shift; ___x_cmd_hn___topic_data "$topic" ;;
        *)
            N=hn M="Invalid topic -> $topic" log:ret:64 ;;
    esac
}

___x_cmd_hn___topic_data(){
    local cur_index_timeout=""
    local proxy=""
    ___x_cmd_hn_cur    cur_index_timeout:=index_timeout     proxy:=     2>/dev/null

    ___x_cmd proxy runifset "$proxy"     ___x_cmd_hn___topic_data___worker "$@"
}

___x_cmd_hn___topic_data___worker(){
    ___x_cmd ccmd "${cur_index_timeout:-"$___X_CMD_HN_DEFAULT_INDEX_TIMEOUT"}" -- \
        ___x_cmd curl -m 5 -L -sS "https://hacker-news.firebaseio.com/v0/${1}stories.json?print=pretty"
}

