mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-06-20 18:58:16 +08:00
build: 📦 整理构建相关的工程文件 (#64)
This commit is contained in:
44
scripts/code.clean.csx
Normal file
44
scripts/code.clean.csx
Normal file
@ -0,0 +1,44 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
|
||||
{
|
||||
var files = string.Join(
|
||||
';',
|
||||
Args[0]
|
||||
.Split('\n', StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(x => x.Replace('\\', '/').Trim())
|
||||
);
|
||||
|
||||
Console.WriteLine(files);
|
||||
|
||||
using var p = Process.Start(
|
||||
new ProcessStartInfo
|
||||
{
|
||||
CreateNoWindow = true,
|
||||
FileName = "dotnet",
|
||||
Arguments = $"jb cleanupcode --include=\"{files}\" --no-build ../NetAdmin.sln",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true
|
||||
}
|
||||
);
|
||||
p.WaitForExit();
|
||||
Console.WriteLine(p.StandardOutput.ReadToEnd());
|
||||
|
||||
using var p2 = Process.Start(
|
||||
new ProcessStartInfo
|
||||
{
|
||||
CreateNoWindow = true,
|
||||
FileName = "git",
|
||||
Arguments = $"status",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true
|
||||
}
|
||||
);
|
||||
p2.WaitForExit();
|
||||
var content = p2.StandardOutput.ReadToEnd();
|
||||
Console.WriteLine(content);
|
||||
|
||||
return content.Contains("working tree clean") ? 0 : 1;
|
||||
}
|
Reference in New Issue
Block a user