From 0e5e48cd00b319488de14ce427d0182c826aa97e Mon Sep 17 00:00:00 2001 From: real-zony Date: Sun, 12 Mar 2023 14:49:47 +0800 Subject: [PATCH] feat: Improved the way help information is displayed. --- src/ZonyLrcTools.Cli/Commands/ToolCommandBase.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ZonyLrcTools.Cli/Commands/ToolCommandBase.cs b/src/ZonyLrcTools.Cli/Commands/ToolCommandBase.cs index 1c2f8f3..b2021da 100644 --- a/src/ZonyLrcTools.Cli/Commands/ToolCommandBase.cs +++ b/src/ZonyLrcTools.Cli/Commands/ToolCommandBase.cs @@ -1,13 +1,23 @@ +using System; using System.Threading.Tasks; using McMaster.Extensions.CommandLineUtils; namespace ZonyLrcTools.Cli.Commands { - [HelpOption("--help|-h", Description = "欢迎使用 ZonyLrcToolsX Command Line Interface,有任何问题请访问 https://soft.myzony.com 或添加 QQ 群 337656932 寻求帮助。")] + [HelpOption("--help|-h", + Description = "欢迎使用 ZonyLrcToolsX Command Line Interface,有任何问题请访问 https://soft.myzony.com 或添加 QQ 群 337656932 寻求帮助。", + ShowInHelpText = true)] public abstract class ToolCommandBase { protected virtual Task OnExecuteAsync(CommandLineApplication app) { + if (Environment.UserInteractive) + { + Console.WriteLine("请使用终端运行此程序,如果你不知道如何操作,请访问 https://soft.myzony.com 或添加 QQ 群 337656932 寻求帮助。"); + Console.ReadKey(); + } + + app.ShowHelp(); return Task.FromResult(0); } }