mirror of
https://github.com/Febbweiss/scrabble-resolver.git
synced 2026-03-05 06:35:38 +00:00
Feature: resolve enigma from command line
This commit is contained in:
@@ -19,7 +19,7 @@ public class Main {
|
||||
private final static Options options = configParameters();
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
//achilst
|
||||
final CommandLineParser parser = new DefaultParser();
|
||||
CommandLine firstLine = null;
|
||||
try {
|
||||
@@ -38,6 +38,7 @@ public class Main {
|
||||
|
||||
try {
|
||||
CommandLine line = parser.parse(options, args);
|
||||
System.out.println(line.getArgList());
|
||||
if( line.hasOption( "build" ) ) {
|
||||
generate(line);
|
||||
} else {
|
||||
@@ -81,10 +82,13 @@ public class Main {
|
||||
final String language = line.getOptionValue("lang", "");
|
||||
final int min = Integer.parseInt(line.getOptionValue("min", "3"));
|
||||
final int max = Integer.parseInt(line.getOptionValue("max", "7"));
|
||||
|
||||
char[] letters = null;
|
||||
if( line.getArgList().size() == 1 ) {
|
||||
letters = line.getArgList().get(0).toCharArray();
|
||||
}
|
||||
try {
|
||||
manageLanguage(language);
|
||||
Enigma enigma = DictionaryBuilder.generateEnigma(language, min, max);
|
||||
Enigma enigma = DictionaryBuilder.generateEnigma(language, min, max, letters);
|
||||
System.out.println(enigma);
|
||||
} catch(IllegalArgumentException e) {
|
||||
System.err.println(e.getMessage());
|
||||
@@ -140,7 +144,7 @@ public class Main {
|
||||
.argName("max")
|
||||
.required(false)
|
||||
.build();
|
||||
|
||||
|
||||
final Options options = new Options();
|
||||
|
||||
options.addOption(buildOption);
|
||||
|
||||
Reference in New Issue
Block a user