use of coloring.ConfigKey in project ASCIIGenome by dariober.
the class InteractiveInput method setConfigOpt.
private void setConfigOpt(List<String> cmdTokens) throws IOException, InvalidConfigException, InvalidCommandLineException, InvalidColourException {
List<String> args = new ArrayList<String>(cmdTokens);
args.remove(0);
if (args.size() == 0) {
throw new InvalidCommandLineException();
}
if (args.size() == 1) {
ConfigKey key = ConfigKey.getConfigKeyFromShort(args.get(0));
if (ConfigKey.booleanKeys().contains(key)) {
// If configkey is a type boolean, just flip the boolean
key = ConfigKey.valueOf(key.toString());
boolean value = !Utils.asBoolean(Config.get(key));
Config.set(key, String.valueOf(value));
} else {
// configKey is expected to be the name of a configuration file
new Config(args.get(0));
}
} else {
ConfigKey key = ConfigKey.getConfigKeyFromShort(args.get(0));
String value = args.get(1);
try {
Config.set(key, value);
} catch (Exception e) {
throw new InvalidConfigException();
}
}
}
Aggregations