feat: 完成yi.abp.tool 0.8.0版本
This commit is contained in:
44
Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/ClearCommand.cs
Normal file
44
Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/ClearCommand.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Yi.Abp.Tool.Commands
|
||||||
|
{
|
||||||
|
public class ClearCommand : ICommand
|
||||||
|
{
|
||||||
|
public List<string> CommandStrs => ["clear"];
|
||||||
|
|
||||||
|
public Task InvokerAsync(Dictionary<string, string> options, string[] args)
|
||||||
|
{
|
||||||
|
List<string> delDirBlacklist = ["obj", "bin"];
|
||||||
|
DeleteObjBinFolders("./", delDirBlacklist);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void DeleteObjBinFolders(string directory, List<string> delDirBlacklist)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (string subDir in Directory.GetDirectories(directory))
|
||||||
|
{
|
||||||
|
if (delDirBlacklist.Contains(subDir))
|
||||||
|
{
|
||||||
|
Directory.Delete(subDir, true);
|
||||||
|
Console.WriteLine($"已删除文件夹:{subDir}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DeleteObjBinFolders(subDir, delDirBlacklist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"无法删除文件夹:{directory},错误信息: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>0.7.0</Version>
|
<Version>0.8.0</Version>
|
||||||
<Authors>橙子老哥</Authors>
|
<Authors>橙子老哥</Authors>
|
||||||
<Description>yi-framework框架配套工具</Description>
|
<Description>yi-framework框架配套工具</Description>
|
||||||
<PackageProjectUrl>https://ccnetcore.com</PackageProjectUrl>
|
<PackageProjectUrl>https://ccnetcore.com</PackageProjectUrl>
|
||||||
|
|||||||
Reference in New Issue
Block a user