private void readOptions(String command, String[] params, int discard) {

		boolean sawNoLocalAuth = false;

		Set<String> allowedParams = ALLOWED_OPTION_MAP.get(command);
		if (allowedParams == null) {
			throw new IllegalArgumentException("Unsupported command: " + command);
		}

		for (int i = discard; i < params.length; ++i) {
			String optionName = params[i];
			String value = null;

			if (optionName.startsWith("-")) {
				// although not prefered, allow option value to be specified as --option=value
				int ix = optionName.indexOf("=");
				if (ix > 1) {
					value = optionName.substring(ix + 1);
					optionName = optionName.substring(0, ix);
				}
			}

			String option = optionName;

			if (optionName.startsWith("-") && !optionName.startsWith("--")) {
				option = SHORTCUT_OPTION_MAP.get(optionName); // map option to -- long form
				if (option == null) {
					throw new IllegalArgumentException("Unsupported option use: " + optionName);
				}
			}

			if (!option.startsWith("--")) {
				throw new IllegalArgumentException("Unexpected argument: " + option);
			}

			if (!GLOBAL_OPTIONS.contains(option) && !allowedParams.contains(option)) {
				throw new IllegalArgumentException("Unsupported option use: " + optionName);
			}

			if (!VALUE_OPTIONS.contains(option)) {
				// option without value arg
				if (value != null) {
					throw new IllegalArgumentException(
						"Unsupported option specification: " + optionName + "=");
				}
			}
			else if (StringUtils.isBlank(value)) {
				// consume next param as option value
				if (++i == params.length) {
					throw new IllegalArgumentException("Missing option value: " + optionName);
				}
				value = params[i];
			}

			switch (option) {
				case PORT_OPTION:
					port = parsePositiveIntegerOption(optionName, value);
					break;
				case USER_OPTION:
					connectingUserName = value;
					break;
				case CERT_OPTION:
					certParameter = value;
					break;
				case CAFILE_OPTION:
					certAuthorityFile = new File(value);
					break;
				case AUTH_OPTION:
					authConfigPresent = true;
					String type = value;
					if (type.equals("pki")) {
						hostAuthentication = AUTHENTICATION_PKI;
						localAuthentication = AUTHENTICATION_PKI;
					}
					else if (type.equals("password")) {
						hostAuthentication = AUTHENTICATION_PASSWORD;
						localAuthentication = AUTHENTICATION_PASSWORD;
					}
					else if (type.equals("trust") || type.equals("none")) {
						hostAuthentication = AUTHENTICATION_NONE;
						localAuthentication = AUTHENTICATION_NONE;
					}
					else {
						throw new IllegalArgumentException("Unknown authentication method: " +
							type + " : options are trust, password or pki");
					}
					break;
				case DN_OPTION:
					distinguishedName = value;
					validateDistinguishedName();
					break;
				case NO_LOCAL_AUTH_OPTION:
					sawNoLocalAuth = true;
					break;
				case FORCE_OPTION:
					forceShutdown = true;
					break;
				default:
					throw new AssertionError("Missing option handling: " + option);
			}
		}

		if (sawNoLocalAuth) {	// Turn off authentication for local connections
			authConfigPresent = true;
			localAuthentication = AUTHENTICATION_NONE;
		}
		if (connectingUserName == null) {
			connectingUserName = ClientUtil.getUserName();
		}
	}
Read in any optional parameters, strip them from the parameter stream
@param command command name
@param params is the original array of command line parameters
@param discard number of params already consumed
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java