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

com.aeontronix.enhancedmule.tools.cli.ActiveProfileCmd Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha4
Show newest version
/*
 * Copyright (c) Aeontronix 2021
 */

package com.aeontronix.enhancedmule.tools.cli;

import com.aeontronix.enhancedmule.config.EMConfig;
import org.fusesource.jansi.Ansi;
import picocli.CommandLine;
import picocli.CommandLine.Parameters;

import java.util.concurrent.Callable;

@CommandLine.Command(name = "profile",description = "Change or show active profile")
public class ActiveProfileCmd implements Callable {
    private EMTCli cli;
    @CommandLine.Option(names = {"?", "-h", "--help"}, usageHelp = true, description = "display this help message")
    boolean usageHelpRequested;
    @Parameters(arity = "0..1",description = "profile to activate")
    private String profile;

    public ActiveProfileCmd(EMTCli cli) {
        this.cli = cli;
    }

    @Override
    public Integer call() throws Exception {
        final EMConfig config = cli.getConfig();
        if( profile != null ) {
            config.setActive(profile);
        }
        System.out.println(Ansi.ansi().a("Active profile: "+config.getActive()));
        return 0;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy