public ClientParameters parseCommandLineArguments(String[] args) {
        try {
            CommandLineParser clp = new DefaultParser();
            CommandLine cl = clp.parse(options, args);
            ClientParameters.Builder builder = new ClientParameters.Builder();

            builder.setHelp(cl.hasOption(HELP_OPTION));
            builder.setDumpData(cl.hasOption(DUMP_OPTION));
            builder.setRoute(cl.getOptionValue(ROUTE_OPTION, "default"));
            builder.setBucketSpace(cl.getOptionValue(BUCKET_SPACE_OPTION, FixedBucketSpaces.defaultSpace()));

            if (cl.hasOption(USER_OPTION)) {
                builder.setSelectionType(ClientParameters.SelectionType.USER);
                builder.setId(cl.getOptionValue(USER_OPTION));
            } else if (cl.hasOption(GROUP_OPTION)) {
                builder.setSelectionType(ClientParameters.SelectionType.GROUP);
                builder.setId(cl.getOptionValue(GROUP_OPTION));
            } else if (cl.hasOption(BUCKET_OPTION)) {
                builder.setSelectionType(ClientParameters.SelectionType.BUCKET);
                builder.setId(cl.getOptionValue(BUCKET_OPTION));
            } else if (cl.hasOption(GID_OPTION)) {
                builder.setSelectionType(ClientParameters.SelectionType.GID);
                builder.setId(cl.getOptionValue(GID_OPTION));
                builder.setDumpData(true);
            } else if (cl.hasOption(DOCUMENT_OPTION)) {
                builder.setSelectionType(ClientParameters.SelectionType.DOCUMENT);
                builder.setId(cl.getOptionValue(DOCUMENT_OPTION));
                builder.setDumpData(true);
            } else if (!cl.hasOption(HELP_OPTION)) {
                throw new IllegalArgumentException("Must specify one of 'user', 'group', 'bucket', 'document' or 'gid'.");
            }

            return builder.build();
        } catch (ParseException e) {
            throw new IllegalArgumentException(e.getMessage(), e);
        }
    }
Responsible for parsing the command line arguments and presenting the help page

@author bjorncs
vespaclient-java/src/main/java/com/yahoo/vespastat/CommandLineOptions.java