private String readCommandLine(String[] params) throws IllegalArgumentException, IOException {

		int slot = 0;

		checkRequiredParam(params, slot, "command");
		String command = params[slot++];

		switch (command) {
			case COMMAND_START:
				scanDataDirectory(params, slot++);
				break;
			case COMMAND_STOP:
				scanDataDirectory(params, slot++);
				break;
			case COMMAND_STATUS:
				scanDataDirectory(params, slot++);
				break;
			case COMMAND_ADDUSER:
				scanDataDirectory(params, slot++);
				scanUsername(params, slot++);
				break;
			case COMMAND_DROPUSER:
				scanDataDirectory(params, slot++);
				scanUsername(params, slot++);
				break;
			case COMMAND_RESET_PASSWORD:
				scanUsername(params, slot++);
				break;
			case COMMAND_CHANGEAUTH:
				scanDataDirectory(params, slot++);
				break;
			case COMMAND_CHANGE_PRIVILEGE:
				scanUsername(params, slot++);
				scanPrivilege(params, slot++);
				break;
			default:
				throw new IllegalArgumentException("Unknown command: " + command);
		}

		readOptions(command, params, slot);

		return command;
	}
Read required parameters followed by optional parameters
@param params is the original array of command line parameters
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java