mirror of
https://github.com/Febbweiss/scrabble-resolver.git
synced 2026-03-04 14:15:37 +00:00
Fix: right way to manage enigma resolution
This commit is contained in:
@@ -38,7 +38,6 @@ public class Main {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
CommandLine line = parser.parse(options, args);
|
CommandLine line = parser.parse(options, args);
|
||||||
System.out.println(line.getArgList());
|
|
||||||
if( line.hasOption( "build" ) ) {
|
if( line.hasOption( "build" ) ) {
|
||||||
generate(line);
|
generate(line);
|
||||||
} else {
|
} else {
|
||||||
@@ -83,8 +82,8 @@ public class Main {
|
|||||||
final int min = Integer.parseInt(line.getOptionValue("min", "3"));
|
final int min = Integer.parseInt(line.getOptionValue("min", "3"));
|
||||||
final int max = Integer.parseInt(line.getOptionValue("max", "7"));
|
final int max = Integer.parseInt(line.getOptionValue("max", "7"));
|
||||||
char[] letters = null;
|
char[] letters = null;
|
||||||
if( line.getArgList().size() == 1 ) {
|
if( line.hasOption("resolve") ) {
|
||||||
letters = line.getArgList().get(0).toCharArray();
|
letters = line.getOptionValue("resolve").toCharArray();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
manageLanguage(language);
|
manageLanguage(language);
|
||||||
@@ -144,12 +143,21 @@ public class Main {
|
|||||||
.argName("max")
|
.argName("max")
|
||||||
.required(false)
|
.required(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
final Option lettersOption = Option.builder("r")
|
||||||
|
.longOpt("resolve")
|
||||||
|
.desc("Find words with the given letters")
|
||||||
|
.hasArg(true)
|
||||||
|
.argName("letters")
|
||||||
|
.required(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
final Options options = new Options();
|
final Options options = new Options();
|
||||||
|
|
||||||
options.addOption(buildOption);
|
options.addOption(buildOption);
|
||||||
options.addOption(helpFileOption);
|
options.addOption(helpFileOption);
|
||||||
options.addOption(languageOption);
|
options.addOption(languageOption);
|
||||||
|
options.addOption(lettersOption);
|
||||||
options.addOption(minOption);
|
options.addOption(minOption);
|
||||||
options.addOption(maxOption);
|
options.addOption(maxOption);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user