feature<Checkout>: add a status panel for checkout progress

This commit is contained in:
leo 2021-05-26 18:43:28 +08:00
parent 001453d6ff
commit 67f5eed9a0
5 changed files with 64 additions and 24 deletions

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
@ -6,13 +7,16 @@ namespace SourceGit.Commands {
/// 检出
/// </summary>
public class Checkout : Command {
private Action<string> handler = null;
public Checkout(string repo) {
Cwd = repo;
}
public bool Branch(string branch) {
Args = $"checkout {branch}";
public bool Branch(string branch, Action<string> onProgress) {
Args = $"checkout --progress {branch}";
TraitErrorAsOutput = true;
handler = onProgress;
return Exec();
}
@ -42,5 +46,9 @@ namespace SourceGit.Commands {
Args = builder.ToString();
return Exec();
}
public override void OnReadline(string line) {
handler?.Invoke(line);
}
}
}