<feat> + git目录检索深度

This commit is contained in:
nsnail 2022-12-06 22:23:31 +08:00
parent e9e94460a9
commit 0e2a8237d0
4 changed files with 18 additions and 1 deletions

View File

@ -75,7 +75,14 @@ public class Main : ToolBase<Option>
StashCurorPos();
var tAnimate = LoadingAnimate(_cursorPosBackup.x, _cursorPosBackup.y, out var cts);
_repoPathList = Directory.GetDirectories(Opt.Path, ".git", SearchOption.AllDirectories)
_repoPathList = Directory.GetDirectories(Opt.Path, ".git" //
, new EnumerationOptions //
{
MaxRecursionDepth = Opt.MaxRecursionDepth
, RecurseSubdirectories = true
, IgnoreInaccessible = true
, AttributesToSkip = FileAttributes.ReparsePoint
})
.Select(x => Directory.GetParent(x)!.FullName)
.ToList();
cts.Cancel();

View File

@ -10,6 +10,10 @@ public class Option : OptionBase
, ResourceType = typeof(Str))]
public string GitOutputEncoding { get; set; }
[Option('d', "max-recursion-depth", HelpText = nameof(Str.MaxRecursionDepth), Default = int.MaxValue
, ResourceType = typeof(Str))]
public int MaxRecursionDepth { get; set; }
[Value(0, HelpText = nameof(Str.FolderPath), Default = ".", ResourceType = typeof(Str))]
public string Path { get; set; }
}

View File

@ -152,4 +152,7 @@
<data name="GitOutputEncoding" xml:space="preserve">
<value>Git output encoding</value>
</data>
<data name="MaxRecursionDepth" xml:space="preserve">
<value>Directory search depth</value>
</data>
</root>

View File

@ -60,6 +60,9 @@
<data name="GitOutputEncoding" xml:space="preserve">
<value>Git输出编码</value>
</data>
<data name="MaxRecursionDepth" xml:space="preserve">
<value>目录检索深度</value>
</data>
<data name="FileSearchPattern" xml:space="preserve">
<value>文件通配符</value>
</data>