sourcegit/src/SourceGit/Commands/QueryFileContent.cs

28 lines
652 B
C#
Raw Normal View History

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