Future<int> process(ArgResults results, { List<String> parentCommandNames })

Invoked on this instance when this command is executed from the command line.

Do not override this method. This method invokes handle within a try-catch block and will invoke cleanup when complete.

Source

Future<int> process(ArgResults results, {List<String> parentCommandNames}) async {
  if (results.command != null) {
    if (parentCommandNames == null) {
      parentCommandNames = [name];
    } else {
      parentCommandNames.add(name);
    }
    return _commandMap[results.command.name].process(results.command, parentCommandNames: parentCommandNames);
  }

  try {
    values = results;

    await determineToolVersion();

    if (!isMachineOutput) {
      displayInfo("Aqueduct CLI Version: $toolVersion");
    }

    preProcess();

    if (helpMeItsScary) {
      printHelp(parentCommandName: parentCommandNames?.join(" "));
      return 0;
    }

    return await handle();
  } on CLIException catch (e, st) {
    displayError(e.message);
    e.instructions?.forEach((instruction) {
      displayProgress(instruction);
    });
    print("");
    if (showStacktrace) {
      displayError("Offending Stacktrace ***", color: CLIColor.red);
      print("$st");
    }
  } on IsolateExecutorException catch (e, st) {
    displayError(e.message);
    displayProgress("Try running 'pub get' first.");
    print("");

    if (showStacktrace) {
      displayError("Offending Stacktrace ***", color: CLIColor.red);
      print("$st");
    }
  } catch (e, st) {
    displayError("$e");
    print("");
    if (showStacktrace) {
      displayError("Offending Stacktrace ***", color: CLIColor.red);
      print("$st");
    }
  } finally {
    await cleanup();
  }
  return 1;
}