| 220 | } |
| 221 | |
| 222 | @Override |
| 223 | protected void parseArgs() throws IOException { |
| 224 | final MainParser arg = new MainParser(this); |
| 225 | while(arg.more()) { |
| 226 | if(arg.dash()) { |
| 227 | switch(arg.next()) { |
| 228 | case 'c': // database command |
| 229 | commands.add(commands(arg.string())); |
| 230 | break; |
| 231 | case 'C': // command script |
| 232 | commands.add(script(arg.string())); |
| 233 | break; |
| 234 | case 'd': // activate debug mode |
| 235 | Prop.debug = true; |
| 236 | break; |
| 237 | case 'D': // hidden flag: daemon mode |
| 238 | daemon = true; |
| 239 | break; |
| 240 | case 'n': // parse host the server is bound to |
| 241 | context.soptions.set(StaticOptions.SERVERHOST, arg.string()); |
| 242 | break; |
| 243 | case 'p': // parse server port |
| 244 | context.soptions.set(StaticOptions.SERVERPORT, arg.number()); |
| 245 | break; |
| 246 | case 'q': // quiet flag (hidden) |
| 247 | quiet = true; |
| 248 | break; |
| 249 | case 'v': // verbose flag |
| 250 | verbose = true; |
| 251 | break; |
| 252 | case 'S': // set service flag |
| 253 | service = !daemon; |
| 254 | break; |
| 255 | case 'z': // suppress logging |
| 256 | context.soptions.set(StaticOptions.LOG, ""); |
| 257 | break; |
| 258 | default: |
| 259 | throw arg.usage(); |
| 260 | } |
| 261 | } else if(S_STOP.equalsIgnoreCase(arg.string())) { |
| 262 | stop = true; |
| 263 | } else { |
| 264 | throw arg.usage(); |
| 265 | } |
| 266 | } |
| 267 | // do not evaluate command if additional service will be started |
| 268 | if(service) commands.clear(); |
| 269 | } |
| 270 | |
| 271 | @Override |
| 272 | public String header() { |