All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.xfournet.jconfig.cli.command.SetCommand Maven / Gradle / Ivy

There is a newer version: 0.8.0
Show newest version
package io.github.xfournet.jconfig.cli.command;

import java.nio.file.Paths;
import java.util.*;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import io.github.xfournet.jconfig.cli.Command;
import io.github.xfournet.jconfig.cli.CommandContext;

@Parameters(commandNames = "set", commandDescription = "Set the value of one or many entries in a file")
public class SetCommand implements Command {

    @Parameter(names = {"--file", "-f"}, description = "File to be updated", required = true)
    private String m_file;

    @Parameter(description = " [ ... ]", required = true)
    private List m_entries = new ArrayList<>();

    @Override
    public void execute(CommandContext ctx) {
        ctx.getJConfig().setEntries(Paths.get(m_file), m_entries);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy