cliApp function

void cliApp(
  1. List<String> arguments
)

This method is the main command-line interface of Bake.

Implementation

void cliApp(List<String> arguments) {
  int argLength = arguments.length;
  if (argLength == 0) {
    String fileContents = getFileContens();
    execFirstRule(fileContents);
  } else if (argLength == 1) {
    if (arguments[0] == '--version') {
      versionInfo();
    } else if (arguments[0] == '--help') {
      helpInfo();
    } else if (arguments[0] == 'init') {
      initBakery();
    } else {
      try {
        String fileContents = getFileContens();
        execRule(fileContents, arguments[0]);
      } catch (e) {
        printColoredString('$e', 'red');
      }
    }
  } else {
    printColoredString('No valid options provided!', 'red');
  }
}