use markdown for list-database-files command

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-16 23:09:54 +00:00
parent 50ce87161b
commit 1ccdba8921
2 changed files with 5 additions and 2 deletions

View file

@ -95,7 +95,8 @@ pub(super) async fn list_database_files(_body: Vec<&str>) -> Result<RoomMessageE
}
let result = services().globals.db.file_list()?;
Ok(RoomMessageEventContent::notice_html(String::new(), result))
Ok(RoomMessageEventContent::notice_markdown(result))
}
pub(super) async fn admin_notice(_body: Vec<&str>, message: Vec<String>) -> Result<RoomMessageEventContent> {

View file

@ -238,10 +238,12 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
Err(e) => Ok(String::from(e)),
Ok(files) => {
let mut res = String::new();
writeln!(res, "| lev | sst | keys | dels | size | column |").expect("written to string buffer");
writeln!(res, "| ---: | :--- | ---: | ---: | ---: | :--- |").expect("written to string buffer");
for file in files {
writeln!(
res,
"<code>L{} {:<13} {:7}+ {:4}- {:9}</code> {}<br>",
"| {} | {:<13} | {:7}+ | {:4}- | {:9} | {} |",
file.level, file.name, file.num_entries, file.num_deletions, file.size, file.column_family_name,
)
.expect("should be able to writeln to string buffer");