org.bidib.wizard.common.script.switching.ConfigCommand Maven / Gradle / Ivy
package org.bidib.wizard.common.script.switching;
import java.util.Scanner;
import org.apache.commons.lang3.StringUtils;
import org.bidib.wizard.api.context.ApplicationContext;
import org.bidib.wizard.api.script.Scripting;
import org.bidib.wizard.api.service.console.ConsoleService;
import org.bidib.wizard.common.script.AbstractScriptCommand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The {@code ConfigCommand} is a helper command to select the correct specific config command.
*/
public class ConfigCommand extends AbstractScriptCommand implements EvaluatedKeyProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigCommand.class);
public static final String KEY = "config";
public ConfigCommand(final ConsoleService consoleService) {
super(consoleService, KEY, null);
}
@Override
public void parse(String commandLine) {
}
@Override
protected void internalExecute(Scripting scripting, ApplicationContext context) {
}
@Override
public String getEvaluatedKey(final Scanner scanner) {
String key2 = scanner.next();
LOGGER.info("The key2 value: {}", key2);
String evaluatedKey = KEY + StringUtils.capitalize(key2);
LOGGER.info("Prepared the evaluatedKey: {}", evaluatedKey);
return evaluatedKey;
}
}