defaultSelectOrganization function

Future<Organization?> defaultSelectOrganization(
  1. String repoName,
  2. List<Organization> organizations
)

Asks the user which organization a repository should be taken from.

Implementation

// coverage:ignore-start
Future<Organization?> defaultSelectOrganization(
  String repoName,
  List<Organization> organizations,
) async {
  gg.throwWhenNotATerminal(
    'the organization prompt',
    'pass the full repository url instead of the plain name "$repoName"',
  );
  final index = await gg.GgPrompts.current.select(
    prompt: '$repoName exists in several organizations. Which one?',
    options: <String>[for (final org in organizations) '${org.name}/$repoName'],
  );
  return organizations[index];
}