Skip to content

Commit e5a05d0

Browse files
committed
人工再改一波
1 parent 6cd2adc commit e5a05d0

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

ApiChanges.3.x-4.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ DotNetCampus.CommandLine 4.0版本带来了全面的架构升级和功能增强
4343

4444
### 破坏性变更和升级指南
4545

46-
1. **命名空间变更**`OptionAttribute``ValueAttribute``VerbAttribute` 的命名空间发生了变化。升级库后,您可能需要借助IDE来修正相关引用。
46+
1. **命名空间变更**`OptionAttribute``ValueAttribute` 的命名空间发生了变化,`VerbAttribute` 名称变为了 `CommandAttribute`。升级库后,您可能需要借助IDE来修正相关引用。
4747

4848
2. **参数解析选项变更**`CommandLine.Parse(args, xxx)` 的第二个参数已从简单的URL scheme字符串升级为完整的 `CommandLineParsingOptions` 对象:
4949
```csharp

src/DotNetCampus.CommandLine.Analyzer/Diagnostics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace DotNetCampus.CommandLine;
88

99
public static class Diagnostics
1010
{
11-
#region Verb/Value/Options Definition 101-199
11+
#region Command/Value/Options Definition 101-199
1212

1313
public static readonly DiagnosticDescriptor DCL101_OptionLongNameMustBeKebabCase = new DiagnosticDescriptor(
1414
nameof(DCL101),

src/DotNetCampus.CommandLine.Analyzer/Generators/BuilderGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ private string GenerateCommandRunnerRegisterCode(CommandObjectGeneratingModel mo
285285
{
286286
var commandCode = model.CommandNames is { } vn ? $"\"{vn}\"" : "null";
287287
return $$"""
288-
// {{model.CommandObjectType.Name}} { VerbName = {{commandCode}} }
288+
// {{model.CommandObjectType.Name}} { CommandName = {{commandCode}} }
289289
global::DotNetCampus.Cli.CommandRunner.Register<{{model.CommandObjectType.ToGlobalDisplayString()}}>(
290290
{{commandCode}},
291291
global::{{model.Namespace}}.{{model.GetBuilderTypeName()}}.CreateInstance);
@@ -322,7 +322,7 @@ private string GenerateAssemblyCommandHandlerMatchCode(IGrouping<string?, Comman
322322
var model = models[0];
323323
if (model.IsHandler)
324324
{
325-
var assignment = group.Key is { } commandName ? $"VerbHandlers[\"{commandName}\"]" : "DefaultHandlerCreator";
325+
var assignment = group.Key is { } commandName ? $"CommandHandlers[\"{commandName}\"]" : "DefaultHandlerCreator";
326326
return $"""
327327
{assignment} = cl => (global::DotNetCampus.Cli.ICommandHandler)global::{model.Namespace}.{model.GetBuilderTypeName()}.CreateInstance(cl);
328328
""";

src/DotNetCampus.CommandLine/Utils/Handlers/GeneratedAssemblyCommandHandlerCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ public abstract class GeneratedAssemblyCommandHandlerCollection : ICommandHandle
1515
/// <summary>
1616
/// 源生成器在构造函数中,为有命令名称的命令处理器赋值。
1717
/// </summary>
18-
protected Dictionary<string, CommandObjectCreator> VerbHandlers { get; init; } = [];
18+
protected Dictionary<string, CommandObjectCreator> CommandHandlers { get; init; } = [];
1919

2020
/// <inheritdoc />
2121
public ICommandHandler? TryMatch(string commandNames, CommandLine commandLine)
2222
{
23-
return commandLine.TryMatch(commandNames, DefaultHandlerCreator, VerbHandlers);
23+
return commandLine.TryMatch(commandNames, DefaultHandlerCreator, CommandHandlers);
2424
}
2525
}

0 commit comments

Comments
 (0)