File tree Expand file tree Collapse file tree 3 files changed +28
-15
lines changed
src/System.CommandLine/Parsing Expand file tree Collapse file tree 3 files changed +28
-15
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,13 @@ public class CliCommandResult : CliSymbolResult
1717 /// Creates a CommandValueResult instance
1818 /// </summary>
1919 /// <param name="command">The CliCommand that the result is for.</param>
20+ /// <param name="locations"></param>
2021 /// <param name="parent">The parent command in the case of a CLI hierarchy, or null if there is no parent.</param>
21- internal CliCommandResult ( CliCommand command , CliCommandResult ? parent = null )
22+ internal CliCommandResult (
23+ CliCommand command ,
24+ IEnumerable < Location > locations ,
25+ CliCommandResult ? parent = null )
26+ : base ( locations )
2227 {
2328 Command = command ;
2429 Parent = parent ;
Original file line number Diff line number Diff line change 11// Copyright (c) .NET Foundation and contributors. All rights reserved.
22// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
4- namespace System . CommandLine . Parsing
4+ using System . Collections . Generic ;
5+
6+ namespace System . CommandLine . Parsing ;
7+
8+ /// <summary>
9+ /// Base class for CliValueResult and CliCommandResult.
10+ /// </summary>
11+ /// <remarks>
12+ /// Common values such as `TextForDisplay` are expected
13+ /// </remarks>
14+ public abstract class CliSymbolResult ( IEnumerable < Location > locations )
515{
6- public class CliSymbolResult
7- {
8- }
9- }
16+ /// <summary>
17+ /// Gets the locations at which the tokens that made up the value appeared.
18+ /// </summary>
19+ /// <remarks>
20+ /// This needs to be a collection for CliValueType because collection types have
21+ /// multiple tokens and they will not be simple offsets when response files are used.
22+ /// </remarks>
23+ public IEnumerable < Location > Locations { get ; } = locations ;
24+
25+ }
Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ private CliValueResult(
1717 ValueResultOutcome outcome ,
1818 // TODO: Error should be an Enumerable<Error> and perhaps should not be here at all, only on ParseResult
1919 string ? error = null )
20+ : base ( locations )
2021 {
2122 ValueSymbol = valueSymbol ;
2223 Value = value ;
23- Locations = locations ;
2424 Outcome = outcome ;
2525 // TODO: Probably a collection of errors here
2626 Error = error ;
@@ -79,14 +79,6 @@ internal CliValueResult(
7979 ? default
8080 : ( T ? ) Value ;
8181
82- /// <summary>
83- /// Gets the locations at which the tokens that made up the value appeared.
84- /// </summary>
85- /// <remarks>
86- /// This needs to be a collection because collection types have multiple tokens and they will not be simple offsets when response files are used.
87- /// </remarks>
88- public IEnumerable < Location > Locations { get ; }
89-
9082 /// <summary>
9183 /// True when parsing and converting the value was successful
9284 /// </summary>
You can’t perform that action at this time.
0 commit comments