using System.Collections.Generic; using System.Text.RegularExpressions; namespace SourceGit.Commands { /// /// 获取子模块列表 /// public class Submodules : Command { private readonly Regex REG_FORMAT = new Regex(@"^[\-\+ ][0-9a-f]+\s(.*)\s\(.*\)$"); private List modules = new List(); public Submodules(string repo) { Cwd = repo; Args = "submodule status"; } public List Result() { Exec(); return modules; } public override void OnReadline(string line) { var match = REG_FORMAT.Match(line); if (!match.Success) return; modules.Add(match.Groups[1].Value); } } }