mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
27 lines
795 B
C#
27 lines
795 B
C#
|
using System;
|
||
|
|
||
|
namespace SourceGit.Commands {
|
||
|
|
||
|
/// <summary>
|
||
|
/// 克隆
|
||
|
/// </summary>
|
||
|
public class Clone : Command {
|
||
|
private Action<string> handler = null;
|
||
|
|
||
|
public Clone(string path, string url, string localName, string extraArgs, Action<string> outputHandler) {
|
||
|
Cwd = path;
|
||
|
TraitErrorAsOutput = true;
|
||
|
Args = "-c credential.helper=manager clone --progress --verbose --recurse-submodules ";
|
||
|
handler = outputHandler;
|
||
|
|
||
|
if (!string.IsNullOrEmpty(extraArgs)) Args += $"{extraArgs} ";
|
||
|
Args += $"{url} ";
|
||
|
if (!string.IsNullOrEmpty(localName)) Args += localName;
|
||
|
}
|
||
|
|
||
|
public override void OnReadline(string line) {
|
||
|
handler?.Invoke(line);
|
||
|
}
|
||
|
}
|
||
|
}
|