mirror of
https://github.com/LordMZTE/mcstat.git
synced 2024-05-05 22:21:11 +02:00
add blank lines and protocol version to table
This commit is contained in:
parent
2de875d9c7
commit
d6710cfac7
|
@ -132,12 +132,17 @@ async fn main() -> Result<()> {
|
||||||
none_if_empty!(remove_formatting(&player_sample)),
|
none_if_empty!(remove_formatting(&player_sample)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
table.blank();
|
||||||
|
|
||||||
table.opt_small_entry(
|
table.opt_small_entry(
|
||||||
"Server Version",
|
"Server Version",
|
||||||
none_if_empty!(remove_formatting(&response.version.name)),
|
none_if_empty!(remove_formatting(&response.version.name)),
|
||||||
);
|
);
|
||||||
table.small_entry("Online Players", &response.players.online);
|
table.small_entry("Online Players", &response.players.online);
|
||||||
table.small_entry("Max Players", &response.players.max);
|
table.small_entry("Max Players", &response.players.max);
|
||||||
|
table.small_entry("Protocol Version", &response.version.protocol);
|
||||||
|
|
||||||
|
table.blank();
|
||||||
|
|
||||||
table.opt_big_entry(
|
table.opt_big_entry(
|
||||||
"Mods",
|
"Mods",
|
||||||
|
|
|
@ -25,6 +25,10 @@ impl Table {
|
||||||
Default::default()
|
Default::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn blank(&mut self) {
|
||||||
|
self.entries.push(Box::new(BlankTableEntry));
|
||||||
|
}
|
||||||
|
|
||||||
pub fn small_entry(&mut self, name: impl ToString, val: impl ToString) {
|
pub fn small_entry(&mut self, name: impl ToString, val: impl ToString) {
|
||||||
let name = name.to_string();
|
let name = name.to_string();
|
||||||
self.set_small_width(name.len());
|
self.set_small_width(name.len());
|
||||||
|
@ -138,3 +142,11 @@ impl TableEntry for OptBigTableEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct BlankTableEntry;
|
||||||
|
|
||||||
|
impl TableEntry for BlankTableEntry {
|
||||||
|
fn print(&self, out: &mut dyn Write, _: &Table) -> io::Result<()> {
|
||||||
|
out.write(b"\n").map(|_| ())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue