java/sql-dk/src/info/globalcode/sql/dk/CLIParser.java
branchv_0
changeset 107 8189a4a28cd8
parent 99 b969176512dd
child 155 eb3676c6929b
equal deleted inserted replaced
106:e9c3583580c8 107:8189a4a28cd8
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    17  */
    17  */
    18 package info.globalcode.sql.dk;
    18 package info.globalcode.sql.dk;
    19 
    19 
    20 import info.globalcode.sql.dk.InfoLister.InfoType;
    20 import info.globalcode.sql.dk.InfoLister.InfoType;
       
    21 import info.globalcode.sql.dk.configuration.Property;
    21 import java.util.ArrayList;
    22 import java.util.ArrayList;
    22 import java.util.HashMap;
    23 import java.util.HashMap;
    23 import java.util.List;
    24 import java.util.List;
    24 import java.util.Map;
    25 import java.util.Map;
    25 
    26 
    98 					}
    99 					}
    99 					break;
   100 					break;
   100 				case Tokens.FORMATTER:
   101 				case Tokens.FORMATTER:
   101 					options.setFormatterName(fetchNext(args, ++i));
   102 					options.setFormatterName(fetchNext(args, ++i));
   102 					break;
   103 					break;
       
   104 				case Tokens.DB_PROPERTY:
       
   105 					options.addDatabaseProperty(new Property(fetchNext(args, ++i), fetchNext(args, ++i)));
       
   106 					break;
       
   107 				case Tokens.FORMATTER_PROPERTY:
       
   108 					options.addFormatterProperty(new Property(fetchNext(args, ++i), fetchNext(args, ++i)));
       
   109 					break;
   103 				case Tokens.INFO_HELP:
   110 				case Tokens.INFO_HELP:
   104 					options.addShowInfo(InfoType.HELP);
   111 					options.addShowInfo(InfoType.HELP);
   105 					break;
   112 					break;
   106 				case Tokens.INFO_FORMATTERS:
   113 				case Tokens.INFO_FORMATTERS:
   107 					options.addShowInfo(InfoType.FORMATTERS);
   114 					options.addShowInfo(InfoType.FORMATTERS);
   139 
   146 
   140 	public static class Tokens {
   147 	public static class Tokens {
   141 
   148 
   142 		// bash-completion:options:
   149 		// bash-completion:options:
   143 		public static final String DB = "--db"; // bash-completion:option // help: database name
   150 		public static final String DB = "--db"; // bash-completion:option // help: database name
       
   151 		public static final String DB_PROPERTY = "--db-property"; // bash-completion:option // help: name and value
   144 		public static final String SQL = "--sql"; // bash-completion:option // help: SQL query/command
   152 		public static final String SQL = "--sql"; // bash-completion:option // help: SQL query/command
   145 		public static final String BATCH = "--batch"; // bash-completion:option // help: batch mode (no argument)
   153 		public static final String BATCH = "--batch"; // bash-completion:option // help: batch mode (no argument)
   146 		public static final String DATA = "--data"; // bash-completion:option // help: list of ordinal parameters
   154 		public static final String DATA = "--data"; // bash-completion:option // help: list of ordinal parameters
   147 		public static final String DATA_NAMED = "--data-named"; // bash-completion:option // help: list of named parameters
   155 		public static final String DATA_NAMED = "--data-named"; // bash-completion:option // help: list of named parameters
   148 		public static final String NAME_PREFIX = "--name-prefix"; // bash-completion:option // help: parameter name prefix – regular expression
   156 		public static final String NAME_PREFIX = "--name-prefix"; // bash-completion:option // help: parameter name prefix – regular expression
   149 		public static final String NAME_SUFFIX = "--name-suffix"; // bash-completion:option // help: parameter name suffix – regular expression
   157 		public static final String NAME_SUFFIX = "--name-suffix"; // bash-completion:option // help: parameter name suffix – regular expression
   150 		public static final String TYPES = "--types"; // bash-completion:option // help: comma separated list of parameter types
   158 		public static final String TYPES = "--types"; // bash-completion:option // help: comma separated list of parameter types
   151 		public static final String FORMATTER = "--formatter"; // bash-completion:option // help: name of the output formatter
   159 		public static final String FORMATTER = "--formatter"; // bash-completion:option // help: name of the output formatter
       
   160 		public static final String FORMATTER_PROPERTY = "--formatter-property"; // bash-completion:option // help: name and value
   152 		public static final String INFO_HELP = "--help"; // bash-completion:option // help: print this help
   161 		public static final String INFO_HELP = "--help"; // bash-completion:option // help: print this help
   153 		public static final String INFO_VERSION = "--version"; // bash-completion:option // help: print version info
   162 		public static final String INFO_VERSION = "--version"; // bash-completion:option // help: print version info
   154 		public static final String INFO_LICENSE = "--license"; // bash-completion:option // help: print license
   163 		public static final String INFO_LICENSE = "--license"; // bash-completion:option // help: print license
   155 		public static final String INFO_FORMATTERS = "--list-formatters"; // bash-completion:option // help: print list of available formatters
   164 		public static final String INFO_FORMATTERS = "--list-formatters"; // bash-completion:option // help: print list of available formatters
   156 		public static final String INFO_TYPES = "--list-types"; // bash-completion:option // help: print list of available data types
   165 		public static final String INFO_TYPES = "--list-types"; // bash-completion:option // help: print list of available data types