feature<Achive>: add git archive to commit's context menu

This commit is contained in:
leo 2021-05-27 22:30:40 +08:00
parent 93835b48bc
commit 3f55d66e01
7 changed files with 182 additions and 2 deletions

22
src/Commands/Archive.cs Normal file
View file

@ -0,0 +1,22 @@
using System;
namespace SourceGit.Commands {
/// <summary>
/// 存档命令
/// </summary>
public class Archive : Command {
private Action<string> handler;
public Archive(string repo, string revision, string to, Action<string> onProgress) {
Cwd = repo;
Args = $"archive --format=zip --verbose --output=\"{to}\" {revision}";
TraitErrorAsOutput = true;
handler = onProgress;
}
public override void OnReadline(string line) {
handler?.Invoke(line);
}
}
}