public VdsVisitParameters parse(String[] args) throws org.apache.commons.cli.ParseException {
            VdsVisitParameters allParams = new VdsVisitParameters();
            VisitorParameters params = new VisitorParameters("");
            CommandLineParser parser = new DefaultParser();
            CommandLine line = parser.parse(options, args);

            if (line.hasOption("h")) {
                return null;
            }
            if (line.hasOption("d")) {
                params.setRemoteDataHandler(line.getOptionValue("d"));
            }
            if (line.hasOption("s")) {
                params.setDocumentSelection(line.getOptionValue("s"));
            }
            if (line.hasOption("bucketspace")) {
                params.setBucketSpace(line.getOptionValue("bucketspace"));
            }
            if (line.hasOption("f")) {
                params.setFromTimestamp(optionAsLong(line, "f"));
            }
            if (line.hasOption("t")) {
                params.setToTimestamp(optionAsLong(line, "t"));
            }
            if (line.hasOption("e")) {
                throw new IllegalArgumentException("Headers only option has been removed.");
            }
            if (line.hasOption("l")) {
                params.fieldSet(line.getOptionValue("l"));
            } else {
                params.fieldSet(DocumentOnly.NAME);
            }
            if (line.hasOption("visitinconsistentbuckets")) {
                params.visitInconsistentBuckets(true);
            }
            if (line.hasOption("m")) {
                params.setMaxPending(optionAsInt(line, "m"));
            }
            if (line.hasOption("b")) {
                params.setMaxBucketsPerVisitor(optionAsInt(line, "b"));
            }
            if (line.hasOption("i")) {
                allParams.setPrintIdsOnly(true);
                params.fieldSet(DocIdOnly.NAME);
            }
            if (line.hasOption("p")) {
                params.setResumeFileName(line.getOptionValue("p"));
            }
            if (line.hasOption("o")) {
                allParams.setFullTimeout(optionAsInt(line, "o"));
                params.setTimeoutMs(allParams.getFullTimeout());
            }
            if (line.hasOption("u")) {
                params.setTimeoutMs(optionAsInt(line, "u"));
            }
            if (line.hasOption("visitlibrary")) {
                params.setVisitorLibrary(line.getOptionValue("visitlibrary"));
            }
            if (line.hasOption("libraryparam")) {
                String key = line.getOptionValues("libraryparam")[0];
                String value = line.getOptionValues("libraryparam")[1];
                params.setLibraryParameter(key, value);
            }
            if (line.hasOption("r")) {
                params.visitRemoves(true);
            }
            if (line.hasOption("c")) {
                allParams.setCluster(line.getOptionValue("c"));
            }

            if (line.hasOption("v")) {
                allParams.setVerbose(true);
            }

            if (line.hasOption("statistics")) {
                allParams.setStatisticsParts(line.getOptionValue("statistics"));
                params.fieldSet(DocIdOnly.NAME);
                params.setVisitorLibrary("CountVisitor");
            }

            if (line.hasOption("abortonclusterdown")) {
                allParams.setAbortOnClusterDown(true);
            }
            if (line.hasOption("processtime")) {
                allParams.setProcessTime(optionAsInt(line, "processtime"));
            }
            if (line.hasOption("maxtotalhits")) {
                params.setMaxTotalHits(optionAsLong(line, "maxtotalhits"));
            }
            if (line.hasOption("tracelevel")) {
                params.setTraceLevel(optionAsInt(line, "tracelevel"));
            }
            if (line.hasOption("priority")) {
                try {
                    DocumentProtocol.Priority priority = DocumentProtocol.getPriorityByName(
                            line.getOptionValue("priority"));
                    params.setPriority(priority);
                } catch (IllegalArgumentException e) {
                    throw new IllegalArgumentException("Unknown priority name");
                }
            } else {
                // Let bulk visitor jobs have a low priority by default to avoid stalling concurrent
                // (real time) write and read operations.
                params.setPriority(DocumentProtocol.Priority.LOW_1);
            }
            if (line.hasOption("skipbucketsonfatalerrors")) {
                params.skipBucketsOnFatalErrors(true);
            }
            if (line.hasOption("maxpendingsuperbuckets")) {
                StaticThrottlePolicy throttlePolicy = new StaticThrottlePolicy();
                throttlePolicy.setMaxPendingCount(optionAsInt(line, "maxpendingsuperbuckets"));
                params.setThrottlePolicy(throttlePolicy);
            }
            if (line.hasOption("shorttensors")) {
                allParams.setTensorShortForm(true);
            }
            if (line.hasOption("tensorvalues")) {
                allParams.setTensorDirectValues(true);
            }
            if (line.hasOption("nullrender")) {
                allParams.setNullRender(true);
            }
            if (line.hasOption("slices") != line.hasOption("sliceid")) {
                throw new IllegalArgumentException("Both --slices and --sliceid must be specified when visiting with slicing");
            }
            if (line.hasOption("slices")) {
                allParams.setSlices(optionAsInt(line, "slices"));
                allParams.setSliceId(optionAsInt(line, "sliceid"));
            }

            boolean jsonOutput = line.hasOption("jsonoutput");
            boolean jsonl      = line.hasOption("jsonl");
            boolean xmlOutput  = line.hasOption("xmloutput");
            if ((jsonOutput || jsonl) && xmlOutput) {
                throw new IllegalArgumentException("Cannot combine both XML and JSON output");
            } else if (jsonOutput && jsonl) {
                throw new IllegalArgumentException("Cannot combine both JSON and JSONL output");
            }
            if (jsonl) {
                allParams.setJsonLinesOutput(true);
            } else {
                allParams.setJsonOutput(!xmlOutput);
            }

            if (allParams.slices() != 1 || allParams.sliceId() != 0) {
                if ((allParams.slices() < 1) || (allParams.sliceId() < 0) || (allParams.sliceId() >= allParams.slices())) {
                    throw new IllegalArgumentException("--slices must be greater than 0 and --sliceid must be in the " +
                                                       "range [0, the value provided for --slices)");
                }
                params.slice(allParams.slices(), allParams.sliceId());
            }

            allParams.setVisitorParameters(params);
            return allParams;
        }
If not specified in options, will get form cluster list
vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java