remotesList method

Future<Map<String, String>> remotesList()

Fetches updates for the default remote in the repository.

Implementation

Future<Map<String, String>> remotesList() async {
  final arguments = ['remote', '-v'];
  final processResult = await executeCommand(
    arguments: arguments,
  );
  final lines = (processResult.stdout as String)
      .trim()
      .split('\n')
      .where((l) => l.contains('(fetch)'))
      .map((l) => l.split(RegExp(r'\s+')))
      .where((element) => element.length > 1)
      .toList();
  return {
    for (final line in lines) line[0]: line[1],
  };
}