prefix every admin room help cmd with -

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-02-17 18:00:34 -05:00 committed by June
parent a0205cd41d
commit a2f7f6fda4

View file

@ -49,37 +49,37 @@ const PAGE_SIZE: usize = 100;
#[command(name = "@conduit:server.name:", version = env!("CARGO_PKG_VERSION"))] #[command(name = "@conduit:server.name:", version = env!("CARGO_PKG_VERSION"))]
enum AdminCommand { enum AdminCommand {
#[command(subcommand)] #[command(subcommand)]
/// Commands for managing appservices /// - Commands for managing appservices
Appservices(AppserviceCommand), Appservices(AppserviceCommand),
#[command(subcommand)] #[command(subcommand)]
/// Commands for managing local users /// - Commands for managing local users
Users(UserCommand), Users(UserCommand),
#[command(subcommand)] #[command(subcommand)]
/// Commands for managing rooms /// - Commands for managing rooms
Rooms(RoomCommand), Rooms(RoomCommand),
#[command(subcommand)] #[command(subcommand)]
/// Commands for managing federation /// - Commands for managing federation
Federation(FederationCommand), Federation(FederationCommand),
#[command(subcommand)] #[command(subcommand)]
/// Commands for managing the server /// - Commands for managing the server
Server(ServerCommand), Server(ServerCommand),
#[command(subcommand)] #[command(subcommand)]
// TODO: should i split out debug commands to a separate thing? the // TODO: should i split out debug commands to a separate thing? the
// debug commands seem like they could fit in the other categories fine // debug commands seem like they could fit in the other categories fine
// this is more like a "miscellaneous" category than a debug one // this is more like a "miscellaneous" category than a debug one
/// Commands for debugging things /// - Commands for debugging things
Debug(DebugCommand), Debug(DebugCommand),
} }
#[cfg_attr(test, derive(Debug))] #[cfg_attr(test, derive(Debug))]
#[derive(Subcommand)] #[derive(Subcommand)]
enum AppserviceCommand { enum AppserviceCommand {
/// Register an appservice using its registration YAML /// - Register an appservice using its registration YAML
/// ///
/// This command needs a YAML generated by an appservice (such as a bridge), /// This command needs a YAML generated by an appservice (such as a bridge),
/// which must be provided in a Markdown code block below the command. /// which must be provided in a Markdown code block below the command.
@ -88,7 +88,7 @@ enum AppserviceCommand {
/// the old one. /// the old one.
Register, Register,
/// Unregister an appservice using its ID /// - Unregister an appservice using its ID
/// ///
/// You can find the ID using the `list-appservices` command. /// You can find the ID using the `list-appservices` command.
Unregister { Unregister {
@ -96,7 +96,7 @@ enum AppserviceCommand {
appservice_identifier: String, appservice_identifier: String,
}, },
/// Show an appservice's config using its ID /// - Show an appservice's config using its ID
/// ///
/// You can find the ID using the `list-appservices` command. /// You can find the ID using the `list-appservices` command.
Show { Show {
@ -104,14 +104,14 @@ enum AppserviceCommand {
appservice_identifier: String, appservice_identifier: String,
}, },
/// List all the currently registered appservices /// - List all the currently registered appservices
List, List,
} }
#[cfg_attr(test, derive(Debug))] #[cfg_attr(test, derive(Debug))]
#[derive(Subcommand)] #[derive(Subcommand)]
enum UserCommand { enum UserCommand {
/// Create a new user /// - Create a new user
Create { Create {
/// Username of the new user /// Username of the new user
username: String, username: String,
@ -119,13 +119,13 @@ enum UserCommand {
password: Option<String>, password: Option<String>,
}, },
/// Reset user password /// - Reset user password
ResetPassword { ResetPassword {
/// Username of the user for whom the password should be reset /// Username of the user for whom the password should be reset
username: String, username: String,
}, },
/// Deactivate a user /// - Deactivate a user
/// ///
/// User will not be removed from all rooms by default. /// User will not be removed from all rooms by default.
/// Use --leave-rooms to force the user to leave all rooms /// Use --leave-rooms to force the user to leave all rooms
@ -135,7 +135,7 @@ enum UserCommand {
user_id: Box<UserId>, user_id: Box<UserId>,
}, },
/// Deactivate a list of users /// - Deactivate a list of users
/// ///
/// Recommended to use in conjunction with list-local-users. /// Recommended to use in conjunction with list-local-users.
/// ///
@ -155,29 +155,29 @@ enum UserCommand {
force: bool, force: bool,
}, },
/// List local users in the database /// - List local users in the database
List, List,
} }
#[cfg_attr(test, derive(Debug))] #[cfg_attr(test, derive(Debug))]
#[derive(Subcommand)] #[derive(Subcommand)]
enum RoomCommand { enum RoomCommand {
/// List all rooms the server knows about /// - List all rooms the server knows about
List { page: Option<usize> }, List { page: Option<usize> },
#[command(subcommand)] #[command(subcommand)]
/// Manage rooms' aliases /// - Manage rooms' aliases
Alias(RoomAliasCommand), Alias(RoomAliasCommand),
#[command(subcommand)] #[command(subcommand)]
/// Manage the room directory /// - Manage the room directory
Directory(RoomDirectoryCommand), Directory(RoomDirectoryCommand),
} }
#[cfg_attr(test, derive(Debug))] #[cfg_attr(test, derive(Debug))]
#[derive(Subcommand)] #[derive(Subcommand)]
enum RoomAliasCommand { enum RoomAliasCommand {
/// Make an alias point to a room. /// - Make an alias point to a room.
Set { Set {
#[arg(short, long)] #[arg(short, long)]
/// Set the alias even if a room is already using it /// Set the alias even if a room is already using it
@ -190,19 +190,19 @@ enum RoomAliasCommand {
room_alias_localpart: String, room_alias_localpart: String,
}, },
/// Remove an alias /// - Remove an alias
Remove { Remove {
/// The alias localpart to remove (`alias`, not `#alias:servername.tld`) /// The alias localpart to remove (`alias`, not `#alias:servername.tld`)
room_alias_localpart: String, room_alias_localpart: String,
}, },
/// Show which room is using an alias /// - Show which room is using an alias
Which { Which {
/// The alias localpart to look up (`alias`, not `#alias:servername.tld`) /// The alias localpart to look up (`alias`, not `#alias:servername.tld`)
room_alias_localpart: String, room_alias_localpart: String,
}, },
/// List aliases currently being used /// - List aliases currently being used
List { List {
/// If set, only list the aliases for this room /// If set, only list the aliases for this room
room_id: Option<Box<RoomId>>, room_id: Option<Box<RoomId>>,
@ -212,41 +212,41 @@ enum RoomAliasCommand {
#[cfg_attr(test, derive(Debug))] #[cfg_attr(test, derive(Debug))]
#[derive(Subcommand)] #[derive(Subcommand)]
enum RoomDirectoryCommand { enum RoomDirectoryCommand {
/// Publish a room to the room directory /// - Publish a room to the room directory
Publish { Publish {
/// The room id of the room to publish /// The room id of the room to publish
room_id: Box<RoomId>, room_id: Box<RoomId>,
}, },
/// Unpublish a room to the room directory /// - Unpublish a room to the room directory
Unpublish { Unpublish {
/// The room id of the room to unpublish /// The room id of the room to unpublish
room_id: Box<RoomId>, room_id: Box<RoomId>,
}, },
/// List rooms that are published /// - List rooms that are published
List { page: Option<usize> }, List { page: Option<usize> },
} }
#[cfg_attr(test, derive(Debug))] #[cfg_attr(test, derive(Debug))]
#[derive(Subcommand)] #[derive(Subcommand)]
enum FederationCommand { enum FederationCommand {
/// List all rooms we are currently handling an incoming pdu from /// - List all rooms we are currently handling an incoming pdu from
IncomingFederation, IncomingFederation,
/// Disables incoming federation handling for a room. /// - Disables incoming federation handling for a room.
DisableRoom { room_id: Box<RoomId> }, DisableRoom { room_id: Box<RoomId> },
/// Enables incoming federation handling for a room again. /// - Enables incoming federation handling for a room again.
EnableRoom { room_id: Box<RoomId> }, EnableRoom { room_id: Box<RoomId> },
/// Verify json signatures /// - Verify json signatures
/// ///
/// This command needs a JSON blob provided in a Markdown code block below /// This command needs a JSON blob provided in a Markdown code block below
/// the command. /// the command.
SignJson, SignJson,
/// Verify json signatures /// - Verify json signatures
/// ///
/// This command needs a JSON blob provided in a Markdown code block below /// This command needs a JSON blob provided in a Markdown code block below
/// the command. /// the command.
@ -256,13 +256,13 @@ enum FederationCommand {
#[cfg_attr(test, derive(Debug))] #[cfg_attr(test, derive(Debug))]
#[derive(Subcommand)] #[derive(Subcommand)]
enum DebugCommand { enum DebugCommand {
/// Get the auth_chain of a PDU /// - Get the auth_chain of a PDU
GetAuthChain { GetAuthChain {
/// An event ID (the $ character followed by the base64 reference hash) /// An event ID (the $ character followed by the base64 reference hash)
event_id: Box<EventId>, event_id: Box<EventId>,
}, },
/// Parse and print a PDU from a JSON /// - Parse and print a PDU from a JSON
/// ///
/// The PDU event is only checked for validity and is not added to the /// The PDU event is only checked for validity and is not added to the
/// database. /// database.
@ -271,7 +271,7 @@ enum DebugCommand {
/// the command. /// the command.
ParsePdu, ParsePdu,
/// Retrieve and print a PDU by ID from the Conduit database /// - Retrieve and print a PDU by ID from the Conduit database
GetPdu { GetPdu {
/// An event ID (a $ followed by the base64 reference hash) /// An event ID (a $ followed by the base64 reference hash)
event_id: Box<EventId>, event_id: Box<EventId>,
@ -283,16 +283,16 @@ enum DebugCommand {
#[cfg_attr(test, derive(Debug))] #[cfg_attr(test, derive(Debug))]
#[derive(Subcommand)] #[derive(Subcommand)]
enum ServerCommand { enum ServerCommand {
/// Show configuration values /// - Show configuration values
ShowConfig, ShowConfig,
/// Print database memory usage statistics /// - Print database memory usage statistics
MemoryUsage, MemoryUsage,
/// Clears all of Conduit's database caches with index smaller than the amount /// - Clears all of Conduit's database caches with index smaller than the amount
ClearDatabaseCaches { amount: u32 }, ClearDatabaseCaches { amount: u32 },
/// Clears all of Conduit's service caches with index smaller than the amount /// - Clears all of Conduit's service caches with index smaller than the amount
ClearServiceCaches { amount: u32 }, ClearServiceCaches { amount: u32 },
} }