Change some terminal commands

This commit is contained in:
Sofia 2020-08-08 02:32:56 +03:00
parent 73b1613be8
commit 6e878cd488
2 changed files with 8 additions and 6 deletions

View File

@ -61,18 +61,20 @@ namespace NeonTea.Quakeball.Interface {
RegisterCommand("help", args => { RegisterCommand("help", args => {
if (args.Length == 0) { if (args.Length == 0) {
Println($"<color={ERROR_COLOR}>Need at least 1 command to give help for</color>"); foreach (string command in Commands.Keys) {
return false; string help = Helps.ContainsKey(command) ? Helps[command] : "No help info";
Println($"{command}: {help}");
}
} }
foreach (string command in args) { foreach (string command in args) {
if (Helps.ContainsKey(command)) { if (Helps.ContainsKey(command)) {
Println($"help {command}: {Helps[command]}"); Println($"help {command}: {Helps[command]}");
} else { } else {
Println($"<color={ERROR_COLOR}>command {command} not found.</color>"); Println($"<color={ERROR_COLOR}>Help for command {command} not found.</color>");
} }
} }
return true; return true;
}); }, "help [command [...]] - Displays help information for the given commands");
Println($"<color={INFO_COLOR}>Welcome to Quakeball!</color>"); Println($"<color={INFO_COLOR}>Welcome to Quakeball!</color>");
} }

View File

@ -23,8 +23,8 @@ namespace NeonTea.Quakeball.Networking {
private void Start() { private void Start() {
if (Terminal.Singleton != null) { if (Terminal.Singleton != null) {
Terminal = Terminal.Singleton; Terminal = Terminal.Singleton;
Terminal.RegisterCommand("host", Host, "host [<port>] [<address>] - Hosts server at given address and port."); Terminal.RegisterCommand("host", Host, "host [port] [address] - Hosts server at given address and port.");
Terminal.RegisterCommand("join", Join, "join [<address>] [<port>] - Tries to join a server at given address and port."); Terminal.RegisterCommand("join", Join, "join [address] [port] - Tries to join a server at given address and port.");
} }
} }