@ShellMethod(key = "add-properties", value = "Add properties associated with a CAS group/module to a Properties/Yaml configuration file.")
    public void add(
        @ShellOption(value = { "file", "--file" },
            help = "Path to the CAS configuration file",
            defaultValue = "/etc/cas/config/cas.properties") final String file,
        @ShellOption(value = { "group", "--group" },
            help = "Group/module whose associated settings should be added to the CAS configuration file") final String group) throws Exception {

        if (StringUtils.isBlank(file)) {
            LOGGER.warn("Configuration file must be specified");
            return;
        }

        val filePath = new File(file);
        if (filePath.exists() && (filePath.isDirectory() || !filePath.canRead() || !filePath.canWrite())) {
            LOGGER.warn("Configuration file [{}] is not readable/writable or is not a path to a file", filePath.getCanonicalPath());
            return;
        }

        val results = findProperties(group);
        LOGGER.info("Located [{}] properties matching [{}]", results.size(), group);

        switch (FilenameUtils.getExtension(filePath.getName()).toLowerCase(Locale.ENGLISH)) {
            case "properties" -> {
                createConfigurationFileIfNeeded(filePath);
                val props = loadPropertiesFromConfigurationFile(filePath);
                writeConfigurationPropertiesToFile(filePath, results, props);
            }
            case "yaml", "yml" -> {
                createConfigurationFileIfNeeded(filePath);
                val yamlProps = CasCoreConfigurationUtils.loadYamlProperties(new FileSystemResource(filePath));
                writeYamlConfigurationPropertiesToFile(filePath, results, yamlProps);
            }
            default -> LOGGER.warn("Configuration file format [{}] is not recognized", filePath.getCanonicalPath());
        }

    }
Add properties to configuration.

@param file  the file
@param group the group
@throws Exception the exception
support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/properties/AddPropertiesToConfigurationCommand.java