style: add .editorconfig for code formatting. see issu #25

This commit is contained in:
leo 2024-03-18 09:37:06 +08:00
parent a8eeea4f78
commit 18aaa0a143
225 changed files with 7781 additions and 3911 deletions

View file

@ -1,10 +1,14 @@
using System;
using System.IO;
namespace SourceGit.Commands {
public class LFS {
class PruneCmd : Command {
public PruneCmd(string repo, Action<string> onProgress) {
namespace SourceGit.Commands
{
public class LFS
{
class PruneCmd : Command
{
public PruneCmd(string repo, Action<string> onProgress)
{
WorkingDirectory = repo;
Context = repo;
Args = "lfs prune";
@ -12,18 +16,21 @@ namespace SourceGit.Commands {
_outputHandler = onProgress;
}
protected override void OnReadline(string line) {
protected override void OnReadline(string line)
{
_outputHandler?.Invoke(line);
}
private Action<string> _outputHandler;
private readonly Action<string> _outputHandler;
}
public LFS(string repo) {
public LFS(string repo)
{
_repo = repo;
}
public bool IsEnabled() {
public bool IsEnabled()
{
var path = Path.Combine(_repo, ".git", "hooks", "pre-push");
if (!File.Exists(path)) return false;
@ -31,10 +38,11 @@ namespace SourceGit.Commands {
return content.Contains("git lfs pre-push");
}
public void Prune(Action<string> outputHandler) {
public void Prune(Action<string> outputHandler)
{
new PruneCmd(_repo, outputHandler).Exec();
}
private string _repo;
private readonly string _repo;
}
}
}