diff --git a/build.ps1 b/build.ps1 index 9885bdb..3cb0581 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,6 +1,4 @@ dotnet build -mkdir ./build/win-x64/lite -dotnet publish -f net7.0 -c Release -r win-x64 --sc -p:"PublishSingleFile=true" -p:"PublishTrimmed=true" -p:"UseSystemResourceKeys=true" -o ./build/win-x64/lite -dotnet publish -f net7.0-windows -c Release -r win-x64 --sc -p:"PublishSingleFile=true" -o ./build/win-x64/full -dotnet publish -f net7.0 -c Release -r linux-x64 --sc -p:"PublishSingleFile=true" -o ./build/linux-x64 +dotnet publish ./src/dot.csproj -f net7.0-windows -c Release -r win-x64 --sc -p:"PublishSingleFile=true" -o ./build/win-x64 +dotnet publish ./src/dot.csproj -f net7.0 -c Release -r linux-x64 --sc -p:"PublishSingleFile=true" -o ./build/linux-x64 Remove-Item -r ./build/temp \ No newline at end of file diff --git a/src/FilesTool.cs b/src/FilesTool.cs index 2ce2286..c2bf8cf 100644 --- a/src/FilesTool.cs +++ b/src/FilesTool.cs @@ -19,7 +19,7 @@ public abstract class FilesTool : ToolBase where TOption : Dir private string[] EnumerateFiles(string path, string searchPattern, out int excludeCnt) { var exCnt = 0; - if (!Opt.ExcludeRegexes.Any()) //默认排除.git 、 node_modules 目录 + if (Opt.ExcludeRegexes?.FirstOrDefault() is null) //默认排除.git 、 node_modules 目录 Opt.ExcludeRegexes = new[] { @"\.git", "node_modules" }; var excludeRegexes = Opt.ExcludeRegexes.Select(x => new Regex(x)); var fileList = Directory.EnumerateFiles(path, searchPattern diff --git a/src/Program.cs b/src/Program.cs index 47d3fb1..5666597 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,3 +1,4 @@ +using System.Text; using Dot; using Dot.Git; @@ -25,40 +26,5 @@ app.Configure(config => { config.ValidateExamples(); }); -return app.Run(args); - - -/*using System.Reflection; -using System.Text; -using Dot; - -Type[] LoadVerbs() -{ - return typeof(Program).Assembly.GetTypes() - // - .Where(x => x.GetCustomAttribute() is not null) - .ToArray(); -} - - -async Task Run(object args) -{ - if (args is not OptionBase option) return; - var tool = ToolsFactory.Create(option); - await tool.Run(); -} - - -// Entry Point Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); -var types = LoadVerbs(); - -try { - await Parser.Default.ParseArguments(args, types).WithParsedAsync(Run); -} -catch (ArgumentException ex) { - AnsiConsole.MarkupLine($"[red]{ex.Message}[/]"); - return -1; -} - -return 0;*/ \ No newline at end of file +return app.Run(args); \ No newline at end of file