@@ -67,38 +67,39 @@ public CommandValueResult CommandValueResult
6767 /// <inheritdoc/>
6868 public override string ToString ( ) => $ "{ nameof ( CommandResult ) } : { IdentifierToken . Value } { string . Join ( " " , Tokens . Select ( t => t . Value ) ) } ";
6969
70+ // TODO: DefaultValues
71+ /*
7072 internal override bool UseDefaultValueFor(ArgumentResult argumentResult)
7173 => argumentResult.Argument.HasDefaultValue && argumentResult.Tokens.Count == 0;
74+ */
7275
76+ // TODO: Validation
77+ /*
7378 /// <param name="completeValidation">Only the inner most command goes through complete validation.</param>
7479 internal void Validate(bool completeValidation)
7580 {
7681 if (completeValidation)
7782 {
78- // TODO: invocation
79- // if (Command.Action is null && Command.HasSubcommands)
8083 if (Command.HasSubcommands)
8184 {
8285 SymbolResultTree.InsertFirstError(
8386 new ParseError(LocalizationResources.RequiredCommandWasNotProvided(), this));
8487 }
8588
8689 // 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+ }
102103 }
103104
104105 // TODO: Validation
@@ -121,7 +122,7 @@ private void ValidateOptions(bool completeValidation)
121122 var option = options[i];
122123
123124 // 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))
125126 if (!completeValidation && !option.Argument.HasDefaultValue)
126127 {
127128 continue;
@@ -165,27 +166,23 @@ private void ValidateOptions(bool completeValidation)
165166 }
166167
167168 // 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+ }
184183
185184 // TODO: Ensure all argument conversions are run for entered values
186- /*
187185 _ = argumentResult.GetArgumentConversionResult();
188- */
189186 }
190187 }
191188
@@ -226,5 +223,6 @@ private void ValidateArguments(bool completeValidation)
226223 _ = argumentResult.GetArgumentConversionResult();
227224 }
228225 }
226+ */
229227 }
230228}
0 commit comments