add --no-details
to admin rooms list command
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
fc1834d629
commit
27bfb67d75
2 changed files with 11 additions and 2 deletions
|
@ -5,7 +5,7 @@ use crate::{admin_command, get_room_info, PAGE_SIZE};
|
||||||
|
|
||||||
#[admin_command]
|
#[admin_command]
|
||||||
pub(super) async fn list_rooms(
|
pub(super) async fn list_rooms(
|
||||||
&self, page: Option<usize>, exclude_disabled: bool, exclude_banned: bool,
|
&self, page: Option<usize>, exclude_disabled: bool, exclude_banned: bool, no_details: bool,
|
||||||
) -> Result<RoomMessageEventContent> {
|
) -> Result<RoomMessageEventContent> {
|
||||||
// TODO: i know there's a way to do this with clap, but i can't seem to find it
|
// TODO: i know there's a way to do this with clap, but i can't seem to find it
|
||||||
let page = page.unwrap_or(1);
|
let page = page.unwrap_or(1);
|
||||||
|
@ -63,7 +63,11 @@ pub(super) async fn list_rooms(
|
||||||
rooms.len(),
|
rooms.len(),
|
||||||
rooms
|
rooms
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(id, members, name)| format!("{id}\tMembers: {members}\tName: {name}"))
|
.map(|(id, members, name)| if no_details {
|
||||||
|
format!("{id}")
|
||||||
|
} else {
|
||||||
|
format!("{id}\tMembers: {members}\tName: {name}")
|
||||||
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join("\n")
|
.join("\n")
|
||||||
);
|
);
|
||||||
|
|
|
@ -27,6 +27,11 @@ pub(super) enum RoomCommand {
|
||||||
/// Excludes rooms that we have banned
|
/// Excludes rooms that we have banned
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
exclude_banned: bool,
|
exclude_banned: bool,
|
||||||
|
|
||||||
|
#[arg(long)]
|
||||||
|
/// Whether to only output room IDs without supplementary room
|
||||||
|
/// information
|
||||||
|
no_details: bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue