code: @Override
      protected void doHandle(CommandContext ctx) throws CommandFormatException {
  
          BatchManager batchManager = ctx.getBatchManager();
          if(!batchManager.isBatchActive()) {
              throw new CommandFormatException("No active batch.");
          }
  
          Batch batch = batchManager.getActiveBatch();
          final int batchSize = batch.size();
          if(batchSize == 0) {
              throw new CommandFormatException("The batch is empty.");
          }
  
          String argsStr = ctx.getArgumentsString();
          if(argsStr == null) {
              throw new CommandFormatException("Missing line number.");
          }
  
          int i = 0;
          while(i < argsStr.length()) {
              if(Character.isWhitespace(argsStr.charAt(i))) {
                  break;
              }
              ++i;
          }
  
          if(i == argsStr.length()) {
              throw new CommandFormatException("Missing the new command line after the index.");
          }
  
          String intStr = argsStr.substring(0, i);
          int lineNumber;
          try {
              lineNumber = Integer.parseInt(intStr);
          } catch(NumberFormatException e) {
              throw new CommandFormatException("Failed to parse line number '" + intStr + "': " + e.getLocalizedMessage());
          }
  
          if(lineNumber < 1 || lineNumber > batchSize) {
              throw new CommandFormatException(lineNumber + " isn't in range [1.." + batchSize + "].");
          }
  
          String editedLine = argsStr.substring(i).trim();
          if(editedLine.length() == 0) {
              throw new CommandFormatException("Missing the new command line after the index.");
          }
  
          if(editedLine.charAt(0) == '"') {
              if(editedLine.length() > 1 && editedLine.charAt(editedLine.length() - 1) == '"') {
                  editedLine = editedLine.substring(1, editedLine.length() - 1);
              }
          }
  
          BatchedCommand newCmd = ctx.toBatchedCommand(editedLine);
          batch.set(lineNumber - 1, newCmd);
          ctx.printLine("#" + lineNumber + " " + newCmd.getCommand());
      }
docs: /* (non-Javadoc)
  @see org.jboss.as.cli.handlers.CommandHandlerWithHelp#doHandle(org.jboss.as.cli.CommandContext)