initial commit, todo comment and realphabetized ServerChatCommand enum

This commit is contained in:
poggly 2022-11-16 01:46:53 -08:00 committed by Ellen Sun
parent 436453556b
commit 75ccd65ec6
2 changed files with 24 additions and 6 deletions

View File

@ -252,8 +252,10 @@ pub enum ServerChatCommand {
BuildAreaList,
BuildAreaRemove,
Campfire,
CreateLocation,
DebugColumn,
DebugWays,
DeleteLocation,
DisconnectAllPlayers,
DropAll,
Dummy,
@ -277,9 +279,12 @@ pub enum ServerChatCommand {
Kit,
Lantern,
Light,
Lightning,
Location,
MakeBlock,
MakeNpc,
MakeSprite,
MakeVolume,
Motd,
Object,
PermitBuild,
@ -305,15 +310,10 @@ pub enum ServerChatCommand {
Unban,
Version,
Waypoint,
WeatherZone,
Whitelist,
Wiring,
World,
MakeVolume,
Location,
CreateLocation,
DeleteLocation,
WeatherZone,
Lightning,
}
impl ServerChatCommand {

View File

@ -121,6 +121,24 @@ impl FromStr for ChatCommandKind {
} else if let Ok(cmd) = s.parse::<ServerChatCommand>() {
Ok(ChatCommandKind::Server(cmd))
} else {
// Idea:
// The ServerChatCommand enum in veloren/common/src/cmd.rs is a list of valid
// commands. We should output something like:
// Could not find a command named "group_kcik"
// Did you mean:
// group_kick
// Could not find a command named "make"
// Did you mean:
// make_block
// make_npc
// make_sprite
// We should be suggesting command(s) similar to the ones typed
// - a regex to match possible typos?
// - Naively suggest the other commands that start with the same first letter?
// (Might be ok, there most commands for a letter is "S" with 10 commands)
Err(format!("Could not find a command named {}.", s))
}
}