| 208 | } |
| 209 | |
| 210 | @Override |
| 211 | protected final void parseArgs() throws IOException { |
| 212 | ops = new IntList(); |
| 213 | vals = new StringList(); |
| 214 | |
| 215 | final MainParser arg = new MainParser(this); |
| 216 | while(arg.more()) { |
| 217 | final char ch; |
| 218 | String v = null; |
| 219 | if(arg.dash()) { |
| 220 | ch = arg.next(); |
| 221 | if(ch == 'd') { |
| 222 | // activate debug mode |
| 223 | Prop.debug = true; |
| 224 | } else if(Strings.contains("t", ch) && local() || Strings.contains("bcCiIoOqQrs", ch)) { |
| 225 | // options followed by a string |
| 226 | v = arg.string(); |
| 227 | } else if(Strings.contains("Du", ch) && local() || Strings.contains("RvVwWxXz", ch)) { |
| 228 | // toggle options |
| 229 | v = ""; |
| 230 | } else if(!local()) { |
| 231 | // client options: need to be set before other options |
| 232 | switch(ch) { |
| 233 | case 'n' -> context.soptions.set(StaticOptions.HOST, arg.string()); |
| 234 | case 'p' -> context.soptions.set(StaticOptions.PORT, arg.number()); |
| 235 | case 'P' -> context.soptions.set(StaticOptions.PASSWORD, arg.string()); |
| 236 | case 'U' -> context.soptions.set(StaticOptions.USER, arg.string()); |
| 237 | default -> throw arg.usage(); |
| 238 | } |
| 239 | } else { |
| 240 | throw arg.usage(); |
| 241 | } |
| 242 | } else { |
| 243 | v = arg.string().trim(); |
| 244 | ch = isFile(v) ? v.endsWith(IO.BXSSUFFIX) ? 'C' : 'Q' : 'q'; |
| 245 | } |
| 246 | if(v != null) { |
| 247 | ops.add(ch); |
| 248 | vals.add(v); |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | @Override |
| 254 | public String header() { |