make HelpBuilder and related APIs internal#2563
Conversation
…PIs, expose Option.GetDefaultValue
2607cbd to
e99a785
Compare
| public System.Collections.Generic.List<System.Action<System.CommandLine.Parsing.OptionResult>> Validators { get; } | ||
| public System.Type ValueType { get; } | ||
| public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions(System.CommandLine.Completions.CompletionContext context) | ||
| public System.Object GetDefaultValue() |
There was a problem hiding this comment.
I needed this to be able to avoid using Option.Argument (internal getter), it contributes to #2526
| helpAction.Builder.CustomizeSymbol(option, secondColumnText: "The custom option description"); | ||
| helpAction.Builder.CustomizeSymbol(argument, secondColumnText: "The custom argument description"); | ||
|
|
||
| var rootCommand = new Command("name") |
There was a problem hiding this comment.
I am using Command rather than RootCommand as it allows me to avoid the need of replacing HelpOption defined in RootCommand.Options
| namespace System.CommandLine.Help | ||
| { | ||
| public partial class HelpBuilder | ||
| internal static class HelpBuilderExtensions |
There was a problem hiding this comment.
this file was called HelpBuilderExtensions.cs and we need to be able to copy this code to SDK, so I decided to move all the extension methods used by the builder here
| /// <summary> | ||
| /// The result of the current parse operation. | ||
| /// </summary> | ||
| public ParseResult ParseResult { get; } |
There was a problem hiding this comment.
It was not used anywhere and the lack of value required a call to ParseResult.Empty() (internal) so I've just removed it
|
Ouch, this is going to break several of my apps. |
Another possibility might be to publish the |
…or multiple subcommands (and having multiple parents) used with GetValue(name)
…arents. We can't allow for name duplicates within the same parent (command).CommandResult
| } | ||
|
|
||
| [Fact] | ||
| public void When_the_same_option_used_in_different_levels_of_the_tree_no_exception_is_thrown() |
There was a problem hiding this comment.
This is a test for a bug I've hit while working on dotnet/sdk#49181:
System.InvalidOperationException: Command build has more than one child named "--interactive".
There was a problem hiding this comment.
I'd quibble about the test name here. The intent is that the option is correctly attributed to the correct descendant.
| { | ||
| if (symbol.Name == node.Symbol.Name && | ||
| symbol.FirstParent?.Symbol is { } parent && | ||
| parent == node.Symbol.FirstParent?.Symbol) |
There was a problem hiding this comment.
A symbol can have multiple parents, so this check was incomplete and wrong.
No description provided.