2024-02-05 23:08:37 -08:00
|
|
|
|
using System;
|
2021-05-27 07:30:40 -07:00
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
namespace SourceGit.Commands
|
|
|
|
|
{
|
|
|
|
|
public class Archive : Command
|
|
|
|
|
{
|
|
|
|
|
public Archive(string repo, string revision, string saveTo, Action<string> outputHandler)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
|
|
|
|
Args = $"archive --format=zip --verbose --output=\"{saveTo}\" {revision}";
|
2021-05-27 07:30:40 -07:00
|
|
|
|
TraitErrorAsOutput = true;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
_outputHandler = outputHandler;
|
2021-05-27 07:30:40 -07:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
protected override void OnReadline(string line)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
_outputHandler?.Invoke(line);
|
2021-05-27 07:30:40 -07:00
|
|
|
|
}
|
2024-02-05 23:08:37 -08:00
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
private readonly Action<string> _outputHandler;
|
2021-05-27 07:30:40 -07:00
|
|
|
|
}
|
2024-03-17 18:37:06 -07:00
|
|
|
|
}
|