Skip to content

Commit 63a0f28

Browse files
committed
Added suffix CLI option
1 parent eaa12fd commit 63a0f28

1 file changed

Lines changed: 14 additions & 22 deletions

File tree

src/main/java/com/ffxivcensus/gatherer/Console.java

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static GathererController run(String [] args){
2626
Options options = setupOptions();
2727

2828
//Declare usage string
29-
String usage = "java -jar XIVStats-Gatherer-Java.jar [-bmqvFPS] -s startid -f finishid [-d database-name] [-u database-user] [-p database-user-password] [-U database-url] [-T table] [-t threads]";
29+
String usage = "java -jar XIVStats-Gatherer-Java.jar [-bmqvxFPS] -s startid -f finishid [-d database-name] [-u database-user] [-p database-user-password] [-U database-url] [-T table] [-t threads]";
3030
HelpFormatter formatter = new HelpFormatter();
3131

3232
try{
@@ -89,32 +89,22 @@ public static GathererController run(String [] args){
8989
gatherer.setTableName(cmd.getOptionValue("T"));
9090
}
9191

92-
//Split tables
93-
gatherer.setSplitTables(cmd.hasOption("S"));
94-
9592
//Verbose mode
96-
if(cmd.hasOption("q")){
97-
gatherer.setQuiet(true);
98-
} else {
99-
gatherer.setQuiet(false);
100-
}
93+
gatherer.setQuiet(cmd.hasOption("q"));
10194

10295
//Debug mode
103-
if(cmd.hasOption("v")){
104-
gatherer.setVerbose(true);
105-
} else{
106-
gatherer.setVerbose(false);
107-
}
96+
gatherer.setVerbose(cmd.hasOption("v"));
10897

10998
//Fail print
110-
if(cmd.hasOption("F")){
111-
gatherer.setPrintFails(true);
112-
}
113-
else
114-
{
115-
gatherer.setPrintFails(false);
116-
}
99+
gatherer.setPrintFails(cmd.hasOption("F"));
100+
101+
//Split tables
102+
gatherer.setStoreMounts(cmd.hasOption("S"));
117103

104+
//Set suffix
105+
if(cmd.hasOption("x")){
106+
gatherer.setTableSuffix(cmd.getOptionValue("x"));
107+
}
118108

119109
gatherer.run();
120110
return gatherer;
@@ -148,10 +138,11 @@ public static Options setupOptions(){
148138
Option optPassword = Option.builder("p").longOpt("password").argName("database-user-password").hasArg().numberOfArgs(1).desc("database user password").build();
149139
Option optThreads = Option.builder("t").longOpt("threads").argName("no-threads").hasArg().numberOfArgs(1).desc("number of gatherer threads to run").build();
150140
Option optTable = Option.builder("T").longOpt("table").hasArg().numberOfArgs(1).argName("table").desc("the table to write records to").build();
151-
Option optSplitTable = Option.builder("S").longOpt("split-table").hasArg().numberOfArgs(1).argName("table-suffix").desc("split tblplayers into multiple tables").build();
141+
Option optSplitTable = Option.builder("S").longOpt("split-table").desc("split tblplayers into multiple tables").build();
152142
Option optQuiet = Option.builder("q").longOpt("quiet").desc("run program in quiet mode - no console output").build();
153143
Option optVerbose = Option.builder("v").longOpt("verbose").desc("run program in verbose bug mode - full console output").build();
154144
Option optFailPrint = Option.builder("F").longOpt("print-failures").desc("print records that don't exist").build();
145+
Option optSuffix = Option.builder("x").longOpt("suffix").hasArg().numberOfArgs(1).argName("table-suffix").desc("suffix to append to all tables").build();
155146

156147
//Add each option to the options object
157148
options.addOption(optStart);
@@ -170,6 +161,7 @@ public static Options setupOptions(){
170161
options.addOption(optQuiet);
171162
options.addOption(optVerbose);
172163
options.addOption(optFailPrint);
164+
options.addOption(optSuffix);
173165

174166
return options;
175167
}

0 commit comments

Comments
 (0)