equal
deleted
inserted
replaced
3 /** |
3 /** |
4 * |
4 * |
5 * @author Ing. František Kučera (frantovo.cz) |
5 * @author Ing. František Kučera (frantovo.cz) |
6 */ |
6 */ |
7 public class CLIStarter { |
7 public class CLIStarter { |
8 |
|
9 public static final String DEFAULT_NAME_PREFIX = ":"; |
|
10 |
8 |
11 public static void main(String[] args) { |
9 public static void main(String[] args) { |
12 |
10 |
13 args = new String[]{"--sql", "SELECT * FROM tabulka;", "--db", "databáze_1"}; |
11 args = new String[]{"--sql", "SELECT * FROM tabulka;", "--db", "databáze_1"}; |
14 |
12 |
17 |
15 |
18 private static CLIOptions parseOptions(String[] args) { |
16 private static CLIOptions parseOptions(String[] args) { |
19 CLIOptions options = new CLIOptions(); |
17 CLIOptions options = new CLIOptions(); |
20 |
18 |
21 String typesString = null; |
19 String typesString = null; |
22 String namePrefix = DEFAULT_NAME_PREFIX; |
|
23 |
|
24 |
20 |
25 for (int i = 0; i < args.length; i++) { |
21 for (int i = 0; i < args.length; i++) { |
26 String arg = args[i]; |
22 String arg = args[i]; |
27 switch (arg) { |
23 switch (arg) { |
28 case Tokens.TYPES: |
24 case Tokens.TYPES: |
29 typesString = args[++i]; |
25 typesString = args[++i]; |
30 break; |
26 break; |
31 case Tokens.NAME_PREFIX: |
27 case Tokens.NAME_PREFIX: |
32 namePrefix = args[++i]; |
28 options.setNamePrefix(args[++i]); |
33 break; |
29 break; |
34 } |
30 } |
35 } |
31 } |
36 |
32 |
37 |
33 |