From 62fef5b30b9bf790967bdbc653a9ca428876fed7 Mon Sep 17 00:00:00 2001 From: nsnail Date: Wed, 7 Dec 2022 17:54:45 +0800 Subject: [PATCH] =?UTF-8?q?=20=E4=BD=BF=E7=94=A8Spectre.Console?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Lang/Str.resx | 16 ++++++++- src/Program.cs | 8 ++--- src/ToLf/Main.cs | 84 +++++++++++++++++++++-------------------------- src/dot.csproj | 1 + 4 files changed, 57 insertions(+), 52 deletions(-) diff --git a/src/Lang/Str.resx b/src/Lang/Str.resx index 5db689d..e7be8a6 100644 --- a/src/Lang/Str.resx +++ b/src/Lang/Str.resx @@ -28,7 +28,7 @@ 输入文本为空 - 查找文件... + 查找文件 指定的路径“{0}”不存在 @@ -182,4 +182,18 @@ 查找 "{0}" 下所有git仓库目录... + + 演习模式, 不会真实修改文件! + + + 读取 + + + + 写入 + + + + 跳过 + \ No newline at end of file diff --git a/src/Program.cs b/src/Program.cs index 3e4e5fb..78b4cab 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,6 +1,7 @@ using System.Reflection; using System.Text; using Dot; +using Spectre.Console; Type[] LoadVerbs() { @@ -18,9 +19,8 @@ async Task Run(object args) var tool = ToolsFactory.Create(option); await tool.Run(); if (option!.KeepSession) { - Console.WriteLine(); - Console.WriteLine(Str.PressAnyKey); - Console.ReadKey(); + AnsiConsole.MarkupLine(Str.PressAnyKey); + AnsiConsole.Console.Input.ReadKey(true); } } @@ -33,7 +33,7 @@ try { await Parser.Default.ParseArguments(args, types).WithParsedAsync(Run); } catch (ArgumentException ex) { - Console.Error.WriteLine(ex.Message); + AnsiConsole.MarkupLine($"[red]{ex.Message}[/]"); return -1; } diff --git a/src/ToLf/Main.cs b/src/ToLf/Main.cs index e05ef03..a061a77 100644 --- a/src/ToLf/Main.cs +++ b/src/ToLf/Main.cs @@ -1,34 +1,25 @@ using System.Diagnostics.CodeAnalysis; +using Spectre.Console; namespace Dot.ToLf; -public sealed class Main : ToolBase