diff --git a/modules/console.cc b/modules/console.cc index 7940a603c..2c3f16d95 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -135,6 +135,7 @@ find_cmd(const string_view &line) struct opt { std::ostream &out; + bool html {false}; operator std::ostream &() { @@ -163,7 +164,12 @@ console_command(std::ostream &out, const string_view &opts) try { - opt opt{out}; + opt opt + { + out, + has(opts, "html") + }; + const cmd *const cmd { find_cmd(line) @@ -595,9 +601,61 @@ console_cmd__db__list(opt &out, const string_view &line) // net // +static bool +html__net__peer(opt &out, const string_view &line) +{ + out << "
HOST | "; + out << "ADDR | "; + out << "LINKS | "; + out << "REQS | "; + out << "▲ BYTES | "; + out << "▼ BYTES | "; + out << "ERROR | "; + out << "
" << host << " | "; + out << "" << ipp << " | "; + + out << "" << peer.link_count() << " | "; + out << "" << peer.tag_count() << " | "; + out << "" << peer.write_total() << " | "; + out << "" << peer.read_total() << " | "; + + out << "";
+ if(peer.err_has() && peer.err_msg())
+ out << peer.err_msg();
+ else if(peer.err_has())
+ out << " | ";
+
+ out << "
"; - command(out, body, {}); + static const string_view opts{"html"}; + command(out, body, opts); out << ""; const auto str //TODO: X