continuwuity/src/admin/server/mod.rs
Jade Ellis 5a66de2633
feat: Generate admin command documentation
The first part of getting admin command docs on the website.

Next is is including it in the same way we do the example config or
readme.

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.
2025-06-14 19:41:17 +01:00

67 lines
1.1 KiB
Rust

mod commands;
use std::path::PathBuf;
use clap::Subcommand;
use conduwuit::Result;
use crate::admin_command_dispatch;
#[admin_command_dispatch]
#[derive(Debug, Subcommand)]
pub enum ServerCommand {
/// - Time elapsed since startup
Uptime,
/// - Show configuration values
ShowConfig,
/// - Reload configuration values
ReloadConfig {
path: Option<PathBuf>,
},
/// - List the features built into the server
ListFeatures {
#[arg(short, long)]
available: bool,
#[arg(short, long)]
enabled: bool,
#[arg(short, long)]
comma: bool,
},
/// - Print database memory usage statistics
MemoryUsage,
/// - Clears all of Continuwuity's caches
ClearCaches,
/// - Performs an online backup of the database (only available for RocksDB
/// at the moment)
BackupDatabase,
/// - List database backups
ListBackups,
/// - Send a message to the admin room.
AdminNotice {
message: Vec<String>,
},
/// - Hot-reload the server
#[clap(alias = "reload")]
ReloadMods,
#[cfg(unix)]
/// - Restart the server
Restart {
#[arg(short, long)]
force: bool,
},
/// - Shutdown the server
Shutdown,
}