private void runCommand(String[] args) { options = new UserOptions(); new JCommander(options, args); if (CollectionUtils.isEmpty(options.getCommands()) || options.getCommands().size() > 1) { throw new RuntimeException("Must have exactly one main param"); } String[] cmdString = options.getCommands().get(0).split(":"); if (cmdString.length == 1) { handleSpecialCommand(cmdString[0]); } else { runNewCommand(cmdString[0], cmdString[1]); } }
private void doRunLoop() { nl(4); PrintOut.start(); spaced("Version " + properties.getProperty("version")); spaced("Welcome user: "******"user.name")); prompt(); sc = new Scanner(System.in); while (sc.hasNextLine()) { String input = sc.nextLine(); if (!Strings.isNullOrEmpty(input)) { try { if (!options.isKeepData()) { brokerHelper.clean(cmd); } else { LOG.warn( "You might get a false positive on reciving response since keep data is enabled"); } runCommand(input.split(" ")); } catch (Exception e) { LOG.error("error", e); } } prompt(); } }
private void waitForServerResponse() { if (!options.isSkipWait()) { LOG.info("waiting for response"); brokerHelper.getResponse(cmd); } }