1 write to Command
System.CommandLine (1)
Parsing\CommandResult.cs (1)
21Command = command ?? throw new ArgumentNullException(nameof(command));
103 references to Command
aspire (6)
Commands\GroupedHelpAction.cs (1)
20if (parseResult.CommandResult.Command == rootCommand)
Commands\NewCommand.cs (3)
143if (parseResult.CommandResult.Command != this) 145var subcommandTemplate = availableTemplates.SingleOrDefault(t => t.Name.Equals(parseResult.CommandResult.Command.Name, StringComparison.OrdinalIgnoreCase)); 153InteractionService.DisplayError($"Template '{parseResult.CommandResult.Command.Name}' is not available. Ensure the required runtime is installed.");
Program.cs (2)
777var parentNames = new List<string> { r.CommandResult.Command.Name }; 781parentNames.Add(parentCommandResult.Command.Name);
crossgen2 (2)
src\runtime\src\coreclr\tools\Common\CommandLineHelpers.cs (2)
215foreach (Option option in res.CommandResult.Command.Options) 272foreach (Argument argument in res.CommandResult.Command.Arguments)
dotnet (43)
CliSchema.cs (1)
82var command = parseResult.CommandResult.Command;
CommandBase.cs (1)
34protected TDefinition Definition { get; } = (TDefinition)parseResult.CommandResult.Command;
Commands\Build\BuildCommand.cs (1)
22var definition = (BuildCommandDefinition)parseResult.CommandResult.Command;
Commands\Clean\CleanCommand.cs (1)
22var definition = (CleanCommandDefinition)result.CommandResult.Command;
Commands\Help\HelpCommand.cs (3)
23var definition = (HelpCommandDefinition)result.CommandResult.Command; 109if (parsedCommand?.CommandResult?.Command?.DocsLink is { } link) 114else if (parsedCommand?.CommandResult?.Command is NuGetDocumentedCommand ndc)
Commands\Hidden\Complete\CompleteCommand.cs (1)
54var definition = (CompleteCommandDefinition)complete.CommandResult.Command;
Commands\Hidden\InternalReportInstallSuccess\InternalReportInstallSuccessCommand.cs (1)
28var definition = (InternalReportInstallSuccessCommandDefinition)result.CommandResult.Command;
Commands\Hidden\Parse\ParseCommand.cs (1)
28var definition = (ParseCommandDefinition)reparsed.CommandResult.Command;
Commands\MSBuild\MSBuildCommand.cs (1)
34var definition = (MSBuildCommandDefinition)parseResult.CommandResult.Command;
Commands\NuGet\NuGetCommand.cs (2)
26if (parseResult.CommandResult.Command.Name == "why" 27&& parseResult.CommandResult.Command.Arguments.FirstOrDefault() is Argument<string> pathArg
Commands\Pack\PackCommand.cs (3)
32var definition = (PackCommandDefinition)parseResult.CommandResult.Command; 92var definition = (PackCommandDefinition)parseResult.CommandResult.Command; 136var definition = (PackCommandDefinition)parseResult.CommandResult.Command;
Commands\Package\Remove\PackageRemoveCommand.cs (1)
16private readonly PackageRemoveCommandDefinitionBase _definition = (PackageRemoveCommandDefinitionBase)parseResult.CommandResult.Command;
Commands\Publish\PublishCommand.cs (1)
31var definition = (PublishCommandDefinition)parseResult.CommandResult.Command;
Commands\Restore\RestoreCommand.cs (1)
22var definition = (RestoreCommandDefinition)result.CommandResult.Command;
Commands\Run\RunCommand.cs (1)
818var definition = (RunCommandDefinition)parseResult.CommandResult.Command;
Commands\Test\MTP\MicrosoftTestingPlatformTestCommand.cs (3)
17var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command; 69var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command; 117var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command;
Commands\Test\MTP\MSBuildUtility.cs (1)
102var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command;
Commands\Test\MTP\TestModulesFilterHandler.cs (1)
23var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command;
Commands\Test\MTP\ValidationUtility.cs (1)
42var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command;
Commands\Test\VSTest\TestCommand.cs (3)
81var definition = (TestCommandDefinition.VSTest)parseResult.CommandResult.Command; 153var definition = (TestCommandDefinition.VSTest)parseResult.CommandResult.Command; 196var definition = (TestCommandDefinition.VSTest)result.CommandResult.Command;
Commands\Tool\Store\StoreCommand.cs (1)
29var definition = (StoreCommandDefinition)result.CommandResult.Command;
Commands\VSTest\VSTestCommand.cs (1)
45var definition = (VSTestCommandDefinition)parseResult.CommandResult.Command;
Extensions\ParseResultExtensions.cs (5)
51if (parseResult.CommandResult.Command.TreatUnmatchedTokensAsErrors 97parseResult.CommandResult.Command.Equals(Parser.RootCommand) && string.IsNullOrEmpty(parseResult.RootSubCommandResult()); 136CommandResult commandResult => commandResult.Command.Name, 187List<string> parentNames = [parseResult.CommandResult.Command.Name]; 191parentNames.Add(parentCommandResult.Command.Name);
ParserOptionActions.cs (1)
97var command = parseResult.CommandResult.Command;
Program.cs (2)
213if (parseResult.CommandResult.Command is InternalReportInstallSuccessCommandDefinition) 297if (commandResult.Command.Name == "new")
Telemetry\AllowListToSendFirstAppliedOptions.cs (1)
25.Children.OfType<System.CommandLine.Parsing.CommandResult>().FirstOrDefault()?.Command.Name ?? null;
Telemetry\AllowListToSendFirstArgument.cs (1)
19System.CommandLine.Parsing.CommandResult commandResult => commandResult.Command.Name,
Telemetry\TelemetryFilter.cs (2)
71parseResult.CommandResult.Command != null && 72parseResult.CommandResult.Command.Name == "update")
dotnet-watch (1)
CommandLine\CommandLineOptions.cs (1)
203var definition = (DotnetWatchCommandDefinition)parseResult.CommandResult.Command;
ilc (2)
src\runtime\src\coreclr\tools\Common\CommandLineHelpers.cs (2)
215foreach (Option option in res.CommandResult.Command.Options) 272foreach (Argument argument in res.CommandResult.Command.Arguments)
Microsoft.DotNet.Cli.CommandLine (3)
ForwardedOptionExtensions.cs (3)
206/// <param name="command">If not provided, uses the <see cref="ParseResult.CommandResult" />'s <see cref="CommandResult.Command"/>.</param> 208=> parseResult.OptionValuesToBeForwarded((command ?? parseResult.CommandResult.Command).Options); 213/// <param name="command">If not provided, uses the <see cref="ParseResult.CommandResult" />'s <see cref="CommandResult.Command"/>.</param>
Microsoft.TemplateEngine.Cli (17)
Commands\BaseFilterableArgs.cs (1)
47var filterableCommand = (IFilterableCommand)parseResult.CommandResult.Command;
Commands\create\InstantiateCommand.cs (1)
252ParseResult updatedParseResult = args.ParseResult.RootCommandResult.Command.Parse(
Commands\create\InstantiateCommandArgs.cs (2)
57Debug.Assert(parseResult.CommandResult.Command is NewCommand); 71public Command NewOrInstantiateCommand => ParseResult.CommandResult.Command;
Commands\Example.cs (8)
17while (commandResult?.Command != null && commandResult.Command is not T) 22if (commandResult?.Command is T typedCommand) 25while (commandResult?.Command != null) 27parentCommands.Add(commandResult.Command.Name); 35T siblingCommand = SearchForSiblingCommand<T>(parseResult.CommandResult.Command); 78var commandParts = parseResult.Tokens.Select(t => t.Value).Prepend(parseResult.RootCommandResult.Command.Name); 79return new Example<T>((T)parseResult.CommandResult.Command, [.. commandParts]);
Commands\GlobalArgs.cs (3)
58while (commandResult?.Command != null && commandResult.Command is not NewCommand) 62if (commandResult == null || commandResult.Command is not NewCommand newCommand)
Commands\NewCommand.Help.cs (1)
15if (context.ParseResult.CommandResult.Command is not NewCommand newCommand)
Commands\update\UpdateCommandArgs.cs (1)
13var definition = ((IUpdateCommand)parseResult.CommandResult.Command).Definition;
System.CommandLine (28)
Binding\ArgumentConversionResult.cs (1)
50string alias = commandResult.Command.Name;
Completions\CompletionAction.cs (1)
29var completionParseResult = parseResult.RootCommandResult.Command.Parse(commandLineToComplete, parseResult.Configuration);
Help\HelpAction.cs (1)
61parseResult.CommandResult.Command,
Invocation\ParseErrorAction.cs (3)
71.Select(r => r.Command.Options.OfType<HelpOption>().FirstOrDefault()); 116Command targetSymbol = commandResult.Command; 127parent.Command.Options.Where(o => o.Recursive && !o.Hidden));
ParseResult.cs (2)
240_ => ((CommandResult)currentSymbolResult).Command 335public CommandLineAction? Action => _action ?? CommandResult.Command.Action;
Parsing\ArgumentResult.cs (2)
98var arguments = parent.Command.Arguments; 105Argument nextArgument = parent.Command.Arguments[nextArgumentIndex];
Parsing\CommandResult.cs (8)
10/// Represents a result produced when parsing a <see cref="Command" />. 50if (Command.HasValidators) 53for (var i = 0; i < Command.Validators.Count; i++) 55Command.Validators[i](this); 65if (Command.HasOptions) 70if (Command.HasArguments) 78var options = Command.Options; 146var arguments = Command.Arguments;
Parsing\ParseOperation.cs (8)
103var arguments = _innermostCommandResult.Command.Arguments; 145var arguments = _innermostCommandResult.Command.Arguments; 156while (_innermostCommandResult.Command.HasArguments && currentArgumentIndex < _innermostCommandResult.Command.Arguments.Count) 158Argument argument = _innermostCommandResult.Command.Arguments[currentArgumentIndex]; 420if (_innermostCommandResult is { Command: { Action: null, HasSubcommands: true } }) 426if (_innermostCommandResult is { Command.Action.ClearsParseErrors: true } && 471.Where(e => e.SymbolResult is CommandResult r && r.Command == command)
Parsing\SymbolResultTree.cs (2)
68if (commandResult.Command.TreatUnmatchedTokensAsErrors) 70if (commandResult != rootCommandResult && !rootCommandResult.Command.TreatUnmatchedTokensAsErrors)
System.CommandLine.StaticCompletions (1)
CompletionsCommandParser.cs (1)
40var script = shell.GenerateCompletions(args.RootCommandResult.Command);