Skip to content

Commit 39c05a3

Browse files
Merge pull request #2405 from KathleenDollard/make-old-result-internal
Make ArgumentResult, OptionResult and CommandResult `internal`
2 parents 50566f7 + 6e2c40f commit 39c05a3

File tree

8 files changed

+15
-14
lines changed

8 files changed

+15
-14
lines changed

src/System.CommandLine.Subsystems/Directives/DiagramSubsystem.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ internal static StringBuilder Diagram(ParseResult parseResult)
3535
var builder = new StringBuilder(100);
3636

3737

38-
Diagram(builder, parseResult.RootCommandResult, parseResult);
38+
// TODO: Reinstate this when ready to implement
39+
//Diagram(builder, parseResult.RootCommandResult, parseResult);
3940

4041
// TODO: Unmatched tokens
4142
/*

src/System.CommandLine/CliArgument{T}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public CliArgument(string name) : base(name)
3434
/// the delegate is also invoked when an input was provided.
3535
/// </remarks>
3636
*/
37-
public Func<ArgumentResult, T>? DefaultValueFactory { get; set; }
37+
internal Func<ArgumentResult, T>? DefaultValueFactory { get; set; }
3838

3939
// TODO: custom parsers
4040
/*

src/System.CommandLine/CliOption{T}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private protected CliOption(string name, string[] aliases, CliArgument<T> argume
3030
}
3131

3232
/// <inheritdoc cref="CliArgument{T}.DefaultValueFactory" />
33-
public Func<ArgumentResult, T>? DefaultValueFactory
33+
internal Func<ArgumentResult, T>? DefaultValueFactory
3434
{
3535
get => _argument.DefaultValueFactory;
3636
set => _argument.DefaultValueFactory = value;

src/System.CommandLine/ParseResult.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ internal ParseResult(
8787
/// <summary>
8888
/// A result indicating the command specified in the command line input.
8989
/// </summary>
90-
public CommandResult CommandResult { get; }
90+
internal CommandResult CommandResult { get; }
9191

9292
/// <summary>
9393
/// The configuration used to produce the parse result.
@@ -97,7 +97,7 @@ internal ParseResult(
9797
/// <summary>
9898
/// Gets the root command result.
9999
/// </summary>
100-
public CommandResult RootCommandResult => _rootCommandResult;
100+
internal CommandResult RootCommandResult => _rootCommandResult;
101101

102102
/// <summary>
103103
/// Gets the parse errors found while parsing command line input.
@@ -180,23 +180,23 @@ CommandLineText is null
180180
/// </summary>
181181
/// <param name="argument">The argument for which to find a result.</param>
182182
/// <returns>A result for the specified argument, or <see langword="null"/> if it was not provided and no default was configured.</returns>
183-
public ArgumentResult? GetResult(CliArgument argument) =>
183+
internal ArgumentResult? GetResult(CliArgument argument) =>
184184
_rootCommandResult.GetResult(argument);
185185

186186
/// <summary>
187187
/// Gets the result, if any, for the specified command.
188188
/// </summary>
189189
/// <param name="command">The command for which to find a result.</param>
190190
/// <returns>A result for the specified command, or <see langword="null"/> if it was not provided.</returns>
191-
public CommandResult? GetResult(CliCommand command) =>
191+
internal CommandResult? GetResult(CliCommand command) =>
192192
_rootCommandResult.GetResult(command);
193193

194194
/// <summary>
195195
/// Gets the result, if any, for the specified option.
196196
/// </summary>
197197
/// <param name="option">The option for which to find a result.</param>
198198
/// <returns>A result for the specified option, or <see langword="null"/> if it was not provided and no default was configured.</returns>
199-
public OptionResult? GetResult(CliOption option) =>
199+
internal OptionResult? GetResult(CliOption option) =>
200200
_rootCommandResult.GetResult(option);
201201

202202
// TODO: Directives

src/System.CommandLine/Parsing/ArgumentResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace System.CommandLine.Parsing
99
/// <summary>
1010
/// A result produced when parsing an <see cref="Argument"/>.
1111
/// </summary>
12-
public sealed class ArgumentResult : SymbolResult
12+
internal sealed class ArgumentResult : SymbolResult
1313
{
1414
private ArgumentConversionResult? _conversionResult;
1515
private bool _onlyTakeHasBeenCalled;

src/System.CommandLine/Parsing/CommandResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace System.CommandLine.Parsing
99
/// <summary>
1010
/// A result produced when parsing a <see cref="Command" />.
1111
/// </summary>
12-
public sealed class CommandResult : SymbolResult
12+
internal sealed class CommandResult : SymbolResult
1313
{
1414
internal CommandResult(
1515
CliCommand command,

src/System.CommandLine/Parsing/OptionResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace System.CommandLine.Parsing
1010
/// <summary>
1111
/// A result produced when parsing an <see cref="Option" />.
1212
/// </summary>
13-
public sealed class OptionResult : SymbolResult
13+
internal sealed class OptionResult : SymbolResult
1414
{
1515
private ArgumentConversionResult? _argumentConversionResult;
1616

src/System.CommandLine/Parsing/SymbolResult.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@ public IEnumerable<ParseError> Errors
7070
/// </summary>
7171
/// <param name="argument">The argument for which to find a result.</param>
7272
/// <returns>An argument result if the argument was matched by the parser or has a default value; otherwise, <c>null</c>.</returns>
73-
public ArgumentResult? GetResult(CliArgument argument) => SymbolResultTree.GetResult(argument);
73+
internal ArgumentResult? GetResult(CliArgument argument) => SymbolResultTree.GetResult(argument);
7474

7575
/// <summary>
7676
/// Finds a result for the specific command anywhere in the parse tree, including parent and child symbol results.
7777
/// </summary>
7878
/// <param name="command">The command for which to find a result.</param>
7979
/// <returns>An command result if the command was matched by the parser; otherwise, <c>null</c>.</returns>
80-
public CommandResult? GetResult(CliCommand command) => SymbolResultTree.GetResult(command);
80+
internal CommandResult? GetResult(CliCommand command) => SymbolResultTree.GetResult(command);
8181

8282
/// <summary>
8383
/// Finds a result for the specific option anywhere in the parse tree, including parent and child symbol results.
8484
/// </summary>
8585
/// <param name="option">The option for which to find a result.</param>
8686
/// <returns>An option result if the option was matched by the parser or has a default value; otherwise, <c>null</c>.</returns>
87-
public OptionResult? GetResult(CliOption option) => SymbolResultTree.GetResult(option);
87+
internal OptionResult? GetResult(CliOption option) => SymbolResultTree.GetResult(option);
8888

8989
// TODO: directives
9090
/*

0 commit comments

Comments
 (0)