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
17
17
/// Creates a CommandValueResult instance
18
18
/// </summary>
19
19
/// <param name="command">The CliCommand that the result is for.</param>
20
+ /// <param name="locations"></param>
20
21
/// <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 )
22
27
{
23
28
Command = command ;
24
29
Parent = parent ;
Original file line number Diff line number Diff line change 1
1
// Copyright (c) .NET Foundation and contributors. All rights reserved.
2
2
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
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 )
5
15
{
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(
17
17
ValueResultOutcome outcome ,
18
18
// TODO: Error should be an Enumerable<Error> and perhaps should not be here at all, only on ParseResult
19
19
string ? error = null )
20
+ : base ( locations )
20
21
{
21
22
ValueSymbol = valueSymbol ;
22
23
Value = value ;
23
- Locations = locations ;
24
24
Outcome = outcome ;
25
25
// TODO: Probably a collection of errors here
26
26
Error = error ;
@@ -79,14 +79,6 @@ internal CliValueResult(
79
79
? default
80
80
: ( T ? ) Value ;
81
81
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
-
90
82
/// <summary>
91
83
/// True when parsing and converting the value was successful
92
84
/// </summary>
You can’t perform that action at this time.
0 commit comments