feat: add help cli arg and add descriptions
This commit is contained in:
parent
355698db1b
commit
67be103c42
@ -29,23 +29,30 @@ import java.util.Map;
|
||||
*/
|
||||
public class Server {
|
||||
private static PartyConfig partyConfig;
|
||||
|
||||
private static ScenarioConfig scenarioConfig;
|
||||
private static CharacterConfig characterConfig;
|
||||
|
||||
private static Integer maxLobbies;
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
ServerArgs serverArgs = new ServerArgs();
|
||||
JCommander jc = JCommander.newBuilder()
|
||||
.addObject(serverArgs)
|
||||
.build();
|
||||
|
||||
try {
|
||||
JCommander.newBuilder()
|
||||
.addObject(serverArgs)
|
||||
.build()
|
||||
.parse(args);
|
||||
jc.parse(args);
|
||||
} catch (ParameterException e) {
|
||||
Logger.error("Invalid parameters: {}", e.getMessage());
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if(serverArgs.isHelp()) {
|
||||
jc.usage();
|
||||
System.exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
// System.out.println(serverArgs);
|
||||
|
@ -11,18 +11,11 @@ public class ServerArgs {
|
||||
private boolean help;
|
||||
|
||||
/** Defines the log level for the current execution of the Server */
|
||||
@Parameter(names = {"-l", "--log-level"}, description = """
|
||||
Log Level
|
||||
0: None
|
||||
1: Error
|
||||
2: Warning
|
||||
3: Info (default)
|
||||
4: debug
|
||||
5: trace""")
|
||||
@Parameter(names = {"-l", "--log-level"}, description = "Log Level: 0 = None, 1 = Error, 2 = Warning, 3 = Info, 4 = Debug, 5 = Trace")
|
||||
private Integer logLevel = 3;
|
||||
|
||||
/** Equivalent to logLevel = 5. Maximum log level (trace) for everything */
|
||||
@Parameter(names = {"-v", "--verbose"})
|
||||
@Parameter(names = {"-v", "--verbose"}, description = "Enables all log messages")
|
||||
private boolean verbose = false;
|
||||
|
||||
/** Port that the server listens on */
|
||||
@ -42,14 +35,14 @@ public class ServerArgs {
|
||||
private File scenarioConfigFile;
|
||||
|
||||
/** Whether the server only checks the configuration files, and then stops execution */
|
||||
@Parameter(names = {"-C", "--check-conf", "--check-config"})
|
||||
@Parameter(names = {"-C", "--check-conf", "--check-config"}, description = "Validates the given config files and exits")
|
||||
private boolean checkConfig = false;
|
||||
|
||||
/** The path to the folder in which replays are saved */
|
||||
@Parameter(names = {"--replay", "-r"})
|
||||
@Parameter(names = {"--replay", "-r"}, description = "Path for replay files to be saved at")
|
||||
private String folderPath;
|
||||
|
||||
@Parameter(names = {"--max-lobbies", "-L", "--team25-max-lobbies"} )
|
||||
@Parameter(names = {"--max-lobbies", "-L", "--team25-max-lobbies"}, description = "Maximum amount of lobbies that can be created")
|
||||
private int maxLobbies = 8;
|
||||
|
||||
/** Whether help is requested */
|
||||
|
Loading…
Reference in New Issue
Block a user