parseProjectTypeArgument method

String parseProjectTypeArgument()

Parse the project type.

Implementation

String parseProjectTypeArgument() {
  // fail if the project type was not provided
  if (!wasParsed(_projectTypeArgument)) {
    throw const UnrecoverableException(
      '$_projectTypeArgument parameter is required',
      exitMissingRequiredArgument,
    );
  }

  final dynamic projectType = this[_projectTypeArgument];

  if (projectType is String &&
      projectType.isNotEmpty &&
      supportedProjectType.contains(projectType)) {
    return projectType;
  } else {
    throw UnrecoverableException(
      '$_projectTypeArgument parameter is required, '
      "supported values are ${supportedProjectType.join(", ")}",
      exitMissingRequiredArgument,
    );
  }
}