execRule function
Executes any rule of a "Bakefile". Which rule is executed is determined by the second parameter.
Implementation
void execRule(String fileContents, String rule) {
List<String> fileC = fileContents.split('\n');
for (int i = 0; i < fileC.length; i++) {
String args = fileC[i];
List<String> ruleTup = getMatches(args);
if (ruleTup.length == 2) {
String ruleName = ruleTup[0];
String ruleCommand = ruleTup[1];
if (ruleExists(fileContents, rule) == true) {
if (ruleName == rule) {
try {
runCommand(ruleCommand);
} on ProcessException catch (e) {
printColoredString('$e', 'red');
}
} else {}
} else {
printColoredString('Rule "$rule" not found!', 'red');
break;
}
} else {}
}
}