mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
refactor<*>: rewrite all codes...
This commit is contained in:
parent
89ff8aa744
commit
30ab8ae954
342 changed files with 17208 additions and 19633 deletions
28
src/Commands/Submodules.cs
Normal file
28
src/Commands/Submodules.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SourceGit.Commands {
|
||||
/// <summary>
|
||||
/// 获取子模块列表
|
||||
/// </summary>
|
||||
public class Submodules : Command {
|
||||
private readonly Regex REG_FORMAT = new Regex(@"^[\-\+ ][0-9a-f]+\s(.*)\s\(.*\)$");
|
||||
private List<string> modules = new List<string>();
|
||||
|
||||
public Submodules(string repo) {
|
||||
Cwd = repo;
|
||||
Args = "submodule status";
|
||||
}
|
||||
|
||||
public List<string> 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue