@@ -67,38 +67,39 @@ public CommandValueResult CommandValueResult
67
67
/// <inheritdoc/>
68
68
public override string ToString ( ) => $ "{ nameof ( CommandResult ) } : { IdentifierToken . Value } { string . Join ( " " , Tokens . Select ( t => t . Value ) ) } ";
69
69
70
+ // TODO: DefaultValues
71
+ /*
70
72
internal override bool UseDefaultValueFor(ArgumentResult argumentResult)
71
73
=> argumentResult.Argument.HasDefaultValue && argumentResult.Tokens.Count == 0;
74
+ */
72
75
76
+ // TODO: Validation
77
+ /*
73
78
/// <param name="completeValidation">Only the inner most command goes through complete validation.</param>
74
79
internal void Validate(bool completeValidation)
75
80
{
76
81
if (completeValidation)
77
82
{
78
- // TODO: invocation
79
- // if (Command.Action is null && Command.HasSubcommands)
80
83
if (Command.HasSubcommands)
81
84
{
82
85
SymbolResultTree.InsertFirstError(
83
86
new ParseError(LocalizationResources.RequiredCommandWasNotProvided(), this));
84
87
}
85
88
86
89
// TODO: validators
87
- /*
88
- if (Command.HasValidators)
89
- {
90
- int errorCountBefore = SymbolResultTree.ErrorCount;
91
- for (var i = 0; i < Command.Validators.Count; i++)
92
- {
93
- Command.Validators[i](this);
94
- }
95
-
96
- if (SymbolResultTree.ErrorCount != errorCountBefore)
97
- {
98
- return;
99
- }
100
- }
101
- */
90
+ if (Command.HasValidators)
91
+ {
92
+ int errorCountBefore = SymbolResultTree.ErrorCount;
93
+ for (var i = 0; i < Command.Validators.Count; i++)
94
+ {
95
+ Command.Validators[i](this);
96
+ }
97
+
98
+ if (SymbolResultTree.ErrorCount != errorCountBefore)
99
+ {
100
+ return;
101
+ }
102
+ }
102
103
}
103
104
104
105
// TODO: Validation
@@ -121,7 +122,7 @@ private void ValidateOptions(bool completeValidation)
121
122
var option = options[i];
122
123
123
124
// TODO: VersionOption, recursive options
124
- // if (!completeValidation && !(option.Recursive || option.Argument.HasDefaultValue || option is VersionOption))
125
+ // if (!completeValidation && !(option.Recursive || option.Argument.HasDefaultValue || option is VersionOption))
125
126
if (!completeValidation && !option.Argument.HasDefaultValue)
126
127
{
127
128
continue;
@@ -165,27 +166,23 @@ private void ValidateOptions(bool completeValidation)
165
166
}
166
167
167
168
// TODO: validators
168
- /*
169
- if (optionResult.Option.HasValidators)
170
- {
171
- int errorsBefore = SymbolResultTree.ErrorCount;
172
-
173
- for (var j = 0; j < optionResult.Option.Validators.Count; j++)
174
- {
175
- optionResult.Option.Validators[j](optionResult);
176
- }
177
-
178
- if (errorsBefore != SymbolResultTree.ErrorCount)
179
- {
180
- continue;
181
- }
182
- }
183
- */
169
+ if (optionResult.Option.HasValidators)
170
+ {
171
+ int errorsBefore = SymbolResultTree.ErrorCount;
172
+
173
+ for (var j = 0; j < optionResult.Option.Validators.Count; j++)
174
+ {
175
+ optionResult.Option.Validators[j](optionResult);
176
+ }
177
+
178
+ if (errorsBefore != SymbolResultTree.ErrorCount)
179
+ {
180
+ continue;
181
+ }
182
+ }
184
183
185
184
// TODO: Ensure all argument conversions are run for entered values
186
- /*
187
185
_ = argumentResult.GetArgumentConversionResult();
188
- */
189
186
}
190
187
}
191
188
@@ -226,5 +223,6 @@ private void ValidateArguments(bool completeValidation)
226
223
_ = argumentResult.GetArgumentConversionResult();
227
224
}
228
225
}
226
+ */
229
227
}
230
228
}
0 commit comments