mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-28 10:48:30 +00:00
feat: Generate admin command documentation
The first part of getting admin command docs on the website. There's also the beginnings of manpage generation here, although it's kinda sus and I'm not sure how it's supposed to work. I'll leave that to anyone who wants to package it. We introduce the beginings of the xtask pattern here - we do a lot of file generation, I thought it would be best to avoid doing that on every compilation. It also helps avoid lots of runtime deps. We'll need to document generating this stuff & probably add pre-commit hooks for it, though.
This commit is contained in:
parent
18d12a7756
commit
d98ce2c7b9
41 changed files with 2977 additions and 33 deletions
|
@ -10,7 +10,7 @@ use crate::{
|
|||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(name = conduwuit_core::name(), version = conduwuit_core::version())]
|
||||
pub(super) enum AdminCommand {
|
||||
pub enum AdminCommand {
|
||||
#[command(subcommand)]
|
||||
/// - Commands for managing appservices
|
||||
Appservices(AppserviceCommand),
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::admin_command_dispatch;
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
#[admin_command_dispatch]
|
||||
pub(super) enum AppserviceCommand {
|
||||
pub enum AppserviceCommand {
|
||||
/// - Register an appservice using its registration YAML
|
||||
///
|
||||
/// This command needs a YAML generated by an appservice (such as a bridge),
|
||||
|
|
|
@ -7,6 +7,6 @@ use crate::admin_command_dispatch;
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(super) enum CheckCommand {
|
||||
pub enum CheckCommand {
|
||||
CheckAllUsers,
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::admin_command_dispatch;
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(super) enum DebugCommand {
|
||||
pub enum DebugCommand {
|
||||
/// - Echo input of admin command
|
||||
Echo {
|
||||
message: Vec<String>,
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{admin_command, admin_command_dispatch};
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, clap::Subcommand)]
|
||||
pub(crate) enum TesterCommand {
|
||||
pub enum TesterCommand {
|
||||
Panic,
|
||||
Failure,
|
||||
Tester,
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::admin_command_dispatch;
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(super) enum FederationCommand {
|
||||
pub enum FederationCommand {
|
||||
/// - List all rooms we are currently handling an incoming pdu from
|
||||
IncomingFederation,
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::admin_command_dispatch;
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(super) enum MediaCommand {
|
||||
pub enum MediaCommand {
|
||||
/// - Deletes a single media file from our database and on the filesystem
|
||||
/// via a single MXC URL or event ID (not redacted)
|
||||
Delete {
|
||||
|
@ -90,10 +90,10 @@ pub(super) enum MediaCommand {
|
|||
#[arg(short, long, default_value("10000"))]
|
||||
timeout: u32,
|
||||
|
||||
#[arg(short, long, default_value("800"))]
|
||||
#[arg(long, default_value("800"))]
|
||||
width: u32,
|
||||
|
||||
#[arg(short, long, default_value("800"))]
|
||||
#[arg(long, default_value("800"))]
|
||||
height: u32,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ conduwuit::mod_ctor! {}
|
|||
conduwuit::mod_dtor! {}
|
||||
conduwuit::rustc_flags_capture! {}
|
||||
|
||||
pub use crate::admin::AdminCommand;
|
||||
|
||||
/// Install the admin command processor
|
||||
pub async fn init(admin_service: &service::admin::Service) {
|
||||
_ = admin_service
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::{admin_command, admin_command_dispatch};
|
|||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// All the getters and iterators from src/database/key_value/account_data.rs
|
||||
pub(crate) enum AccountDataCommand {
|
||||
pub enum AccountDataCommand {
|
||||
/// - Returns all changes to the account data that happened after `since`.
|
||||
ChangesSince {
|
||||
/// Full user ID
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::Context;
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// All the getters and iterators from src/database/key_value/appservice.rs
|
||||
pub(crate) enum AppserviceCommand {
|
||||
pub enum AppserviceCommand {
|
||||
/// - Gets the appservice registration info/details from the ID as a string
|
||||
GetRegistration {
|
||||
/// Appservice registration ID
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::Context;
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// All the getters and iterators from src/database/key_value/globals.rs
|
||||
pub(crate) enum GlobalsCommand {
|
||||
pub enum GlobalsCommand {
|
||||
DatabaseVersion,
|
||||
|
||||
CurrentCount,
|
||||
|
|
|
@ -27,7 +27,7 @@ use crate::admin_command_dispatch;
|
|||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// Query tables from database
|
||||
pub(super) enum QueryCommand {
|
||||
pub enum QueryCommand {
|
||||
/// - account_data.rs iterators and getters
|
||||
#[command(subcommand)]
|
||||
AccountData(AccountDataCommand),
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::Context;
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// All the getters and iterators from src/database/key_value/presence.rs
|
||||
pub(crate) enum PresenceCommand {
|
||||
pub enum PresenceCommand {
|
||||
/// - Returns the latest presence event for the given user.
|
||||
GetPresence {
|
||||
/// Full user ID
|
||||
|
|
|
@ -5,7 +5,7 @@ use ruma::OwnedUserId;
|
|||
use crate::Context;
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(crate) enum PusherCommand {
|
||||
pub enum PusherCommand {
|
||||
/// - Returns all the pushers for the user.
|
||||
GetPushers {
|
||||
/// Full user ID
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::{admin_command, admin_command_dispatch};
|
|||
#[derive(Debug, Subcommand)]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
/// Query tables from database
|
||||
pub(crate) enum RawCommand {
|
||||
pub enum RawCommand {
|
||||
/// - List database maps
|
||||
RawMaps,
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::{admin_command, admin_command_dispatch};
|
|||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// Resolver service and caches
|
||||
pub(crate) enum ResolverCommand {
|
||||
pub enum ResolverCommand {
|
||||
/// Query the destinations cache
|
||||
DestinationsCache {
|
||||
server_name: Option<OwnedServerName>,
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::Context;
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// All the getters and iterators from src/database/key_value/rooms/alias.rs
|
||||
pub(crate) enum RoomAliasCommand {
|
||||
pub enum RoomAliasCommand {
|
||||
ResolveLocalAlias {
|
||||
/// Full room alias
|
||||
alias: OwnedRoomAliasId,
|
||||
|
|
|
@ -6,7 +6,7 @@ use ruma::{OwnedRoomId, OwnedServerName, OwnedUserId};
|
|||
use crate::Context;
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(crate) enum RoomStateCacheCommand {
|
||||
pub enum RoomStateCacheCommand {
|
||||
ServerInRoom {
|
||||
server: OwnedServerName,
|
||||
room_id: OwnedRoomId,
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::{admin_command, admin_command_dispatch};
|
|||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// Query tables from database
|
||||
pub(crate) enum RoomTimelineCommand {
|
||||
pub enum RoomTimelineCommand {
|
||||
Pdus {
|
||||
room_id: OwnedRoomOrAliasId,
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::Context;
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// All the getters and iterators from src/database/key_value/sending.rs
|
||||
pub(crate) enum SendingCommand {
|
||||
pub enum SendingCommand {
|
||||
/// - Queries database for all `servercurrentevent_data`
|
||||
ActiveRequests,
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{admin_command, admin_command_dispatch};
|
|||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// Query tables from database
|
||||
pub(crate) enum ShortCommand {
|
||||
pub enum ShortCommand {
|
||||
ShortEventId {
|
||||
event_id: OwnedEventId,
|
||||
},
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::{admin_command, admin_command_dispatch};
|
|||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
/// All the getters and iterators from src/database/key_value/users.rs
|
||||
pub(crate) enum UsersCommand {
|
||||
pub enum UsersCommand {
|
||||
CountUsers,
|
||||
|
||||
IterUsers,
|
||||
|
|
|
@ -8,7 +8,7 @@ use ruma::{OwnedRoomAliasId, OwnedRoomId};
|
|||
use crate::Context;
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(crate) enum RoomAliasCommand {
|
||||
pub enum RoomAliasCommand {
|
||||
/// - Make an alias point to a room.
|
||||
Set {
|
||||
#[arg(short, long)]
|
||||
|
|
|
@ -6,7 +6,7 @@ use ruma::OwnedRoomId;
|
|||
use crate::{Context, PAGE_SIZE, get_room_info};
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(crate) enum RoomDirectoryCommand {
|
||||
pub enum RoomDirectoryCommand {
|
||||
/// - Publish a room to the room directory
|
||||
Publish {
|
||||
/// The room id of the room to publish
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{admin_command, admin_command_dispatch};
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(crate) enum RoomInfoCommand {
|
||||
pub enum RoomInfoCommand {
|
||||
/// - List joined members in a room
|
||||
ListJoinedMembers {
|
||||
room_id: OwnedRoomId,
|
||||
|
|
|
@ -16,7 +16,7 @@ use crate::admin_command_dispatch;
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(super) enum RoomCommand {
|
||||
pub enum RoomCommand {
|
||||
/// - List all rooms the server knows about
|
||||
#[clap(alias = "list")]
|
||||
ListRooms {
|
||||
|
|
|
@ -12,7 +12,7 @@ use crate::{admin_command, admin_command_dispatch, get_room_info};
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(crate) enum RoomModerationCommand {
|
||||
pub enum RoomModerationCommand {
|
||||
/// - Bans a room from local users joining and evicts all our local users
|
||||
/// (including server
|
||||
/// admins)
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::admin_command_dispatch;
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(super) enum ServerCommand {
|
||||
pub enum ServerCommand {
|
||||
/// - Time elapsed since startup
|
||||
Uptime,
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::admin_command_dispatch;
|
|||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(super) enum UserCommand {
|
||||
pub enum UserCommand {
|
||||
/// - Create a new user
|
||||
#[clap(alias = "create")]
|
||||
CreateUser {
|
||||
|
|
|
@ -14,6 +14,13 @@ rust-version.workspace = true
|
|||
version.workspace = true
|
||||
metadata.crane.workspace = true
|
||||
|
||||
[lib]
|
||||
path = "mod.rs"
|
||||
crate-type = [
|
||||
"rlib",
|
||||
# "dylib",
|
||||
]
|
||||
|
||||
[package.metadata.deb]
|
||||
name = "conduwuit"
|
||||
maintainer = "strawberry <strawberry@puppygock.gay>"
|
||||
|
|
14
src/main/mod.rs
Normal file
14
src/main/mod.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
#![type_length_limit = "49152"] //TODO: reduce me
|
||||
|
||||
use conduwuit_core::rustc_flags_capture;
|
||||
|
||||
pub(crate) mod clap;
|
||||
mod logging;
|
||||
mod mods;
|
||||
mod restart;
|
||||
mod runtime;
|
||||
mod sentry;
|
||||
mod server;
|
||||
mod signal;
|
||||
|
||||
rustc_flags_capture! {}
|
Loading…
Add table
Add a link
Reference in a new issue