mirror of
https://github.com/nsnail/dot.git
synced 2025-06-17 13:03:22 +08:00
<refactor>
This commit is contained in:
parent
1c66b36e34
commit
a35ebfcb23
@ -7,6 +7,12 @@
|
|||||||
"commands": [
|
"commands": [
|
||||||
"t4"
|
"t4"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"dotnet-consolidate": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-consolidate"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,23 +8,23 @@ app.Configure(config => {
|
|||||||
config.SetApplicationName(AssemblyInfo.ASSEMBLY_PRODUCT);
|
config.SetApplicationName(AssemblyInfo.ASSEMBLY_PRODUCT);
|
||||||
config.SetApplicationVersion(AssemblyInfo.ASSEMBLY_VERSION);
|
config.SetApplicationVersion(AssemblyInfo.ASSEMBLY_VERSION);
|
||||||
|
|
||||||
config.AddCommand<Main>("git");
|
config.AddCommand<Main>(nameof(Dot.Git).ToLower());
|
||||||
#if NET7_0_WINDOWS
|
#if NET7_0_WINDOWS
|
||||||
config.AddCommand<Dot.Color.Main>("color");
|
config.AddCommand<Dot.Color.Main>(nameof(Dot.Color).ToLower());
|
||||||
#endif
|
#endif
|
||||||
config.AddCommand<Dot.Guid.Main>("guid");
|
config.AddCommand<Dot.Guid.Main>(nameof(Dot.Guid).ToLower());
|
||||||
config.AddCommand<Dot.IP.Main>("ip");
|
config.AddCommand<Dot.IP.Main>(nameof(Dot.IP).ToLower());
|
||||||
config.AddCommand<Dot.Json.Main>("json");
|
config.AddCommand<Dot.Json.Main>(nameof(Dot.Json).ToLower());
|
||||||
config.AddCommand<Dot.Pwd.Main>("pwd");
|
config.AddCommand<Dot.Pwd.Main>(nameof(Dot.Pwd).ToLower());
|
||||||
config.AddCommand<Dot.RmBlank.Main>("rblank");
|
config.AddCommand<Dot.Rbom.Main>(nameof(Dot.Rbom).ToLower());
|
||||||
config.AddCommand<Dot.RmBom.Main>("rbom");
|
config.AddCommand<Dot.Trim.Main>(nameof(Dot.Trim).ToLower());
|
||||||
config.AddCommand<Dot.Text.Main>("text");
|
config.AddCommand<Dot.Text.Main>(nameof(Dot.Text).ToLower());
|
||||||
config.AddCommand<Dot.Time.Main>("time");
|
config.AddCommand<Dot.Time.Main>(nameof(Dot.Time).ToLower());
|
||||||
config.AddCommand<Dot.ToLf.Main>("tolf");
|
config.AddCommand<Dot.ToLf.Main>(nameof(Dot.ToLf).ToLower());
|
||||||
|
|
||||||
|
|
||||||
config.ValidateExamples();
|
config.ValidateExamples();
|
||||||
});
|
});
|
||||||
|
|
||||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
return app.Run(args);
|
return app.Run(args);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Dot.RmBom;
|
namespace Dot.Rbom;
|
||||||
|
|
||||||
[Description(nameof(Str.TrimUtf8Bom))]
|
[Description(nameof(Str.TrimUtf8Bom))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Str))]
|
||||||
@ -43,4 +43,4 @@ public sealed class Main : FilesTool<Option>
|
|||||||
|
|
||||||
if (tmpFile != default) File.Delete(tmpFile);
|
if (tmpFile != default) File.Delete(tmpFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
3
src/Rbom/Option.cs
Normal file
3
src/Rbom/Option.cs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
namespace Dot.Rbom;
|
||||||
|
|
||||||
|
public class Option : DirOption { }
|
@ -1,3 +0,0 @@
|
|||||||
namespace Dot.RmBom;
|
|
||||||
|
|
||||||
public class Option : DirOption { }
|
|
@ -137,7 +137,7 @@ public sealed class Main : ToolBase<Option>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task Run()
|
protected override async Task Run()
|
||||||
{
|
{
|
||||||
await Core();
|
await Core();
|
||||||
if (Opt.KeepSession) {
|
if (Opt.KeepSession) {
|
||||||
|
@ -2,7 +2,7 @@ namespace Dot;
|
|||||||
|
|
||||||
public abstract class ToolBase<TOption> : Command<TOption> where TOption : OptionBase
|
public abstract class ToolBase<TOption> : Command<TOption> where TOption : OptionBase
|
||||||
{
|
{
|
||||||
protected TOption Opt { get; set; }
|
protected TOption Opt { get; private set; }
|
||||||
protected abstract Task Core();
|
protected abstract Task Core();
|
||||||
|
|
||||||
public override int Execute(CommandContext context, TOption option)
|
public override int Execute(CommandContext context, TOption option)
|
||||||
@ -12,7 +12,7 @@ public abstract class ToolBase<TOption> : Command<TOption> where TOption : Optio
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task Run()
|
protected virtual async Task Run()
|
||||||
{
|
{
|
||||||
await Core();
|
await Core();
|
||||||
if (Opt.KeepSession) {
|
if (Opt.KeepSession) {
|
||||||
@ -20,4 +20,4 @@ public abstract class ToolBase<TOption> : Command<TOption> where TOption : Optio
|
|||||||
AnsiConsole.Console.Input.ReadKey(true);
|
AnsiConsole.Console.Input.ReadKey(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
using Dot.RmBlank;
|
||||||
using NSExt.Extensions;
|
using NSExt.Extensions;
|
||||||
|
|
||||||
namespace Dot.RmBlank;
|
namespace Dot.Trim;
|
||||||
|
|
||||||
[Description(nameof(Str.RemoveTrailingWhiteSpaces))]
|
[Description(nameof(Str.RemoveTrailingWhiteSpaces))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Str))]
|
||||||
@ -49,4 +50,4 @@ public sealed class Main : FilesTool<Option>
|
|||||||
ShowMessage(0, 1, 0);
|
ShowMessage(0, 1, 0);
|
||||||
UpdateStats(Path.GetExtension(file));
|
UpdateStats(Path.GetExtension(file));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user