2024-02-05 23:08:37 -08:00
|
|
|
|
using System.Text;
|
2021-04-29 05:05:55 -07:00
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
namespace SourceGit.Commands
|
|
|
|
|
{
|
|
|
|
|
public class QueryFileContent : Command
|
|
|
|
|
{
|
|
|
|
|
public QueryFileContent(string repo, string revision, string file)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
|
|
|
|
Args = $"show {revision}:\"{file}\"";
|
2021-04-29 05:05:55 -07:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public string Result()
|
|
|
|
|
{
|
2021-04-29 05:05:55 -07:00
|
|
|
|
Exec();
|
2024-02-05 23:08:37 -08:00
|
|
|
|
return _builder.ToString();
|
2021-04-29 05:05:55 -07:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
protected override void OnReadline(string line)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
_builder.Append(line);
|
|
|
|
|
_builder.Append('\n');
|
2021-04-29 05:05:55 -07:00
|
|
|
|
}
|
2024-02-05 23:08:37 -08:00
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
private readonly StringBuilder _builder = new StringBuilder();
|
2021-04-29 05:05:55 -07:00
|
|
|
|
}
|
2024-03-17 18:37:06 -07:00
|
|
|
|
}
|