mirror of
https://github.com/nsnail/dot.git
synced 2025-06-19 13:58:16 +08:00
<refactor> 移除 https://github.com/commandlineparser/commandline.git
This commit is contained in:
@ -8,6 +8,8 @@ using System.Diagnostics;
|
||||
|
||||
namespace Dot.Text;
|
||||
|
||||
[Description(nameof(Str.TextTool))]
|
||||
[Localization(typeof(Str))]
|
||||
public sealed class Main : ToolBase<Option>
|
||||
{
|
||||
private ref struct Output
|
||||
@ -28,7 +30,6 @@ public sealed class Main : ToolBase<Option>
|
||||
public ReadOnlySpan<char> UrlEncode;
|
||||
}
|
||||
|
||||
public Main(Option opt) : base(opt) { }
|
||||
|
||||
private static Output BuildOutput(string text, Encoding enc)
|
||||
{
|
||||
@ -107,7 +108,11 @@ html-decode: {o.HtmlDecode}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if NET7_0_WINDOWS
|
||||
protected override async Task Core()
|
||||
#else
|
||||
protected override Task Core()
|
||||
#endif
|
||||
{
|
||||
#if NET7_0_WINDOWS
|
||||
if (Opt.Text.NullOrEmpty()) Opt.Text = await ClipboardService.GetTextAsync();
|
||||
@ -116,5 +121,8 @@ html-decode: {o.HtmlDecode}
|
||||
|
||||
|
||||
ParseAndShow(Opt.Text);
|
||||
#if !NET7_0_WINDOWS
|
||||
return Task.CompletedTask;
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
namespace Dot.Text;
|
||||
|
||||
[Verb("text", HelpText = nameof(Str.TextTool), ResourceType = typeof(Str))]
|
||||
public class Option : OptionBase
|
||||
{
|
||||
[Value(0, HelpText = nameof(Str.TextTobeProcessed), ResourceType = typeof(Str))]
|
||||
[CommandArgument(0, "[input text]")]
|
||||
[Description(nameof(Str.TextTobeProcessed))]
|
||||
[Localization(typeof(Str))]
|
||||
public string Text { get; set; }
|
||||
}
|
Reference in New Issue
Block a user