26 import java.util.HashMap; |
26 import java.util.HashMap; |
27 import java.util.List; |
27 import java.util.List; |
28 import java.util.Map; |
28 import java.util.Map; |
29 |
29 |
30 /** |
30 /** |
31 * Converts command line arguments from String array to object. |
31 * Converts command line arguments from String array to object. Checks basic constraints (if only |
32 * Checks basic constraints (if only supported options are used and if they have correct number of |
32 * supported options are used and if they have correct number of parameters) |
33 * parameters) |
|
34 * |
33 * |
35 * @author Ing. František Kučera (frantovo.cz) |
34 * @author Ing. František Kučera (frantovo.cz) |
36 */ |
35 */ |
37 public class CLIParser { |
36 public class CLIParser { |
38 |
37 |
109 String paramName = args[i]; |
108 String paramName = args[i]; |
110 String paramValue = fetchNext(args, ++i); |
109 String paramValue = fetchNext(args, ++i); |
111 options.addNamedParameter(new NamedParameter(paramName, paramValue, namedTypes.get(paramName))); |
110 options.addNamedParameter(new NamedParameter(paramName, paramValue, namedTypes.get(paramName))); |
112 } |
111 } |
113 break; |
112 break; |
|
113 case Tokens.RELATION: |
|
114 options.addRelationName(fetchNext(args, ++i)); |
|
115 break; |
114 case Tokens.FORMATTER: |
116 case Tokens.FORMATTER: |
115 options.setFormatterName(fetchNext(args, ++i)); |
117 options.setFormatterName(fetchNext(args, ++i)); |
116 break; |
118 break; |
117 case Tokens.DB_PROPERTY: |
119 case Tokens.DB_PROPERTY: |
118 options.addDatabaseProperty(new Property(fetchNext(args, ++i), fetchNext(args, ++i))); |
120 options.addDatabaseProperty(new Property(fetchNext(args, ++i), fetchNext(args, ++i))); |
185 public static final String DATA = "--data"; // bash-completion:option // help: list of ordinal parameters |
187 public static final String DATA = "--data"; // bash-completion:option // help: list of ordinal parameters |
186 public static final String DATA_NAMED = "--data-named"; // bash-completion:option // help: list of named parameters |
188 public static final String DATA_NAMED = "--data-named"; // bash-completion:option // help: list of named parameters |
187 public static final String NAME_PREFIX = "--name-prefix"; // bash-completion:option // help: parameter name prefix – regular expression |
189 public static final String NAME_PREFIX = "--name-prefix"; // bash-completion:option // help: parameter name prefix – regular expression |
188 public static final String NAME_SUFFIX = "--name-suffix"; // bash-completion:option // help: parameter name suffix – regular expression |
190 public static final String NAME_SUFFIX = "--name-suffix"; // bash-completion:option // help: parameter name suffix – regular expression |
189 public static final String TYPES = "--types"; // bash-completion:option // help: comma separated list of parameter types |
191 public static final String TYPES = "--types"; // bash-completion:option // help: comma separated list of parameter types |
|
192 public static final String RELATION = "--relation"; // bash-completion:option // help: name of the output relation (result set) |
190 public static final String FORMATTER = "--formatter"; // bash-completion:option // help: name of the output formatter |
193 public static final String FORMATTER = "--formatter"; // bash-completion:option // help: name of the output formatter |
191 public static final String FORMATTER_PROPERTY = "--formatter-property"; // bash-completion:option // help: name and value |
194 public static final String FORMATTER_PROPERTY = "--formatter-property"; // bash-completion:option // help: name and value |
192 public static final String INFO_HELP = "--help"; // bash-completion:option // help: print this help |
195 public static final String INFO_HELP = "--help"; // bash-completion:option // help: print this help |
193 public static final String INFO_VERSION = "--version"; // bash-completion:option // help: print version info |
196 public static final String INFO_VERSION = "--version"; // bash-completion:option // help: print version info |
194 public static final String INFO_LICENSE = "--license"; // bash-completion:option // help: print license |
197 public static final String INFO_LICENSE = "--license"; // bash-completion:option // help: print license |