You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -124,6 +124,9 @@
124
124
public System.Collections.Generic.IReadOnlyList<System.String> UnmatchedTokens { get; }
125
125
public System.CommandLine.Completions.CompletionContext GetCompletionContext()
126
126
public System.Collections.Generic.IEnumerable<System.CommandLine.Completions.CompletionItem> GetCompletions(System.Nullable<System.Int32> position = null)
127
+
public T GetRequiredValue<T>(Argument<T> argument)
128
+
public T GetRequiredValue<T>(Option<T> option)
129
+
public T GetRequiredValue<T>(System.String name)
127
130
public System.CommandLine.Parsing.ArgumentResult GetResult(Argument argument)
128
131
public System.CommandLine.Parsing.CommandResult GetResult(Command command)
129
132
public System.CommandLine.Parsing.OptionResult GetResult(Option option)
@@ -234,6 +237,9 @@ System.CommandLine.Parsing
234
237
public SymbolResult Parent { get; }
235
238
public System.Collections.Generic.IReadOnlyList<Token> Tokens { get; }
236
239
public System.Void AddError(System.String errorMessage)
240
+
public T GetRequiredValue<T>(Argument<T> argument)
241
+
public T GetRequiredValue<T>(Option<T> option)
242
+
public T GetRequiredValue<T>(System.String name)
237
243
public ArgumentResult GetResult(System.CommandLine.Argument argument)
238
244
public CommandResult GetResult(System.CommandLine.Command command)
239
245
public OptionResult GetResult(System.CommandLine.Option option)
Copy file name to clipboardExpand all lines: src/System.CommandLine/ParseResult.cs
+29Lines changed: 29 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,35 @@ CommandLineText is null
133
133
publicT?GetValue<T>(stringname)
134
134
=>RootCommandResult.GetValue<T>(name);
135
135
136
+
/// <summary>
137
+
/// Gets the parsed or default value for the specified required argument or throws.
138
+
/// </summary>
139
+
/// <param name="argument">The argument for which to get a value.</param>
140
+
/// <returns>The parsed value or a configured default.</returns>
141
+
/// <exception cref="InvalidOperationException">Thrown when required argument was not parsed or has no default value configured.</exception>
142
+
publicTGetRequiredValue<T>(Argument<T>argument)
143
+
=>RootCommandResult.GetRequiredValue(argument);
144
+
145
+
/// <summary>
146
+
/// Gets the parsed or default value for the specified required option or throws.
147
+
/// </summary>
148
+
/// <param name="option">The option for which to get a value.</param>
149
+
/// <returns>The parsed value or a configured default.</returns>
150
+
/// <exception cref="InvalidOperationException">Thrown when required option was not parsed or has no default value configured.</exception>
151
+
publicTGetRequiredValue<T>(Option<T>option)
152
+
=>RootCommandResult.GetRequiredValue(option);
153
+
154
+
/// <summary>
155
+
/// Gets the parsed or default value for the specified required symbol name, in the context of parsed command (not entire symbol tree).
156
+
/// </summary>
157
+
/// <param name="name">The name of the required Symbol for which to get a value.</param>
158
+
/// <returns>The parsed value or a configured default.</returns>
159
+
/// <exception cref="InvalidOperationException">Thrown when parsing resulted in parse error(s) or required symbol was not parsed or has no default value configured.</exception>
160
+
/// <exception cref="ArgumentException">Thrown when there was no symbol defined for given name for the parsed command.</exception>
161
+
/// <exception cref="InvalidCastException">Thrown when parsed result can not be cast to <typeparamref name="T"/>.</exception>
0 commit comments