gitSubcommand function

String? gitSubcommand(
  1. List<String> arguments
)

The subcommand of the Git command line arguments: its first argument that is neither a global option nor the value of one, such as clone in -c protocol.version=2 clone <url>. Null when it names none.

Implementation

String? gitSubcommand(List<String> arguments) {
  for (var index = 0; index < arguments.length; index++) {
    final argument = arguments[index];
    if (_globalOptionsWithValue.contains(argument)) {
      index++;
    } else if (!argument.startsWith('-')) {
      return argument;
    }
  }
  return null;
}