Skip to content

Commit 90fb5c3

Browse files
Fixed whitespace, commented out dead code
1 parent 397ab7b commit 90fb5c3

File tree

4 files changed

+43
-36
lines changed

4 files changed

+43
-36
lines changed

src/System.CommandLine/Parsing/CommandResult.cs

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/System.CommandLine/Parsing/OptionResult.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ internal bool IsArgumentLimitReached
9393
internal ArgumentConversionResult ArgumentConversionResult
9494
=> _argumentConversionResult ??= GetResult(Option.Argument)!.GetArgumentConversionResult();
9595

96+
// TODO: Default values
97+
/*
9698
internal override bool UseDefaultValueFor(ArgumentResult argument) => Implicit;
99+
*/
97100
}
98101
}

src/System.CommandLine/Parsing/ParseOperation.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ private void AddCurrentTokenToUnmatched()
389389
_symbolResultTree.AddUnmatchedToken(CurrentToken, _innermostCommandResult, _rootCommandResult);
390390
}
391391

392+
// TODO: Validation
393+
/*
392394
private void Validate()
393395
{
394396
// Only the inner most command goes through complete validation,
@@ -403,5 +405,6 @@ private void Validate()
403405
currentResult = currentResult.Parent as CommandResult;
404406
}
405407
}
408+
*/
406409
}
407410
}

src/System.CommandLine/Parsing/SymbolResult.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ public IEnumerable<ParseError> Errors
156156
}
157157
*/
158158

159+
// TODO: DefaultValues
160+
/*
159161
internal virtual bool UseDefaultValueFor(ArgumentResult argumentResult) => false;
162+
*/
160163
}
161164
}

0 commit comments

Comments
 (0)