1 write to Command
System.CommandLine (1)
Parsing\CommandResult.cs (1)
21Command = command ?? throw new ArgumentNullException(nameof(command));
91 references to Command
aspire (12)
Commands\GroupedHelpAction.cs (1)
20if (parseResult.CommandResult.Command == rootCommand)
Commands\NewCommand.cs (3)
299if (parseResult.CommandResult.Command != this) 301var subcommandTemplate = availableTemplates.SingleOrDefault(t => t.Name.Equals(parseResult.CommandResult.Command.Name, StringComparison.OrdinalIgnoreCase)); 309InteractionService.DisplayError($"Template '{parseResult.CommandResult.Command.Name}' is not available. Ensure the required runtime is installed.");
Commands\ParseResultHelper.cs (1)
349CollectOptionNames(parentCommandResult.Command.Options, includeOnlyRecursive: true, knownOptions);
Commands\ResourceCommand.cs (4)
789foreach (var option in commandResult.Command.Options) 800foreach (var option in parentCommandResult.Command.Options) 816AddOptionNames(commandResult.Command.Options, includeOnlyRecursive: false, names); 821AddOptionNames(parentCommandResult.Command.Options, includeOnlyRecursive: true, names);
Program.cs (3)
1119InitializeCommandTelemetry(parseResult.CommandResult.Command, telemetryManager, 1319var parentNames = new List<string> { r.CommandResult.Command.Name }; 1323parentNames.Add(parentCommandResult.Command.Name);
Aspire.Cli.Tests (4)
Commands\AgentTelemetryCommandTests.cs (4)
37Program.InitializeCommandTelemetry(result.CommandResult.Command, manager, fixture.Telemetry); 72Program.InitializeCommandTelemetry(result.CommandResult.Command, manager, fixture.Telemetry); 113Program.InitializeCommandTelemetry(result.CommandResult.Command, manager, fixture.Telemetry); 136var command = provider.GetRequiredService<RootCommand>().Parse(["doctor"]).CommandResult.Command;
crossgen2 (2)
parent\parent\Common\CommandLineHelpers.cs (2)
237foreach (Option option in res.CommandResult.Command.Options) 294foreach (Argument argument in res.CommandResult.Command.Arguments)
dotnet-aot (23)
parent\dotnet\CliSchema.cs (1)
82var command = parseResult.CommandResult.Command;
parent\dotnet\CommandBase.cs (1)
30protected TDefinition Definition { get; } = (TDefinition)parseResult.CommandResult.Command;
parent\dotnet\CommandInvocation.cs (1)
59if (commandResult.Command.Name == "new")
parent\dotnet\Commands\Run\AotRunCommand.cs (1)
55var definition = (RunCommandDefinition)parseResult.CommandResult.Command;
parent\dotnet\Commands\Test\AotTestCommand.cs (1)
29if (parseResult.CommandResult.Command is not TestCommandDefinition.MicrosoftTestingPlatform definition
parent\dotnet\Commands\Test\MTP\MicrosoftTestingPlatformTestCommand.cs (3)
39var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command; 1006var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command; 1193var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command;
parent\dotnet\Commands\Test\MTP\TestCommandOptions.cs (1)
19var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command;
parent\dotnet\Commands\Test\MTP\TestModulesFilterHandler.cs (1)
26var definition = (TestCommandDefinition.MicrosoftTestingPlatform)parseResult.CommandResult.Command;
parent\dotnet\Extensions\ParseResultExtensions.cs (6)
24parseResult.CommandResult.Command.Equals(Parser.RootCommand) && string.IsNullOrEmpty(parseResult.RootSubCommandResult()); 38parseResult.CommandResult.Command.Equals(Parser.RootCommand) 83CommandResult commandResult => commandResult.Command.Name, 154if (parseResult.CommandResult.Command.TreatUnmatchedTokensAsErrors 246List<string> parentNames = [parseResult.CommandResult.Command.Name]; 250parentNames.Add(parentCommandResult.Command.Name);
parent\dotnet\FirstRunExperience.cs (1)
76if (parseResult.CommandResult.Command is InternalReportInstallSuccessCommandDefinition)
parent\dotnet\Parser.cs (1)
294&& Array.Exists(_managedHelpCommands, c => ReferenceEquals(c, commandResult.Command)))
parent\dotnet\ParserOptionActions.cs (1)
104var command = parseResult.CommandResult.Command;
parent\dotnet\Telemetry\AllowListToSendFirstAppliedOptions.cs (1)
25.Children.OfType<System.CommandLine.Parsing.CommandResult>().FirstOrDefault()?.Command.Name ?? null;
parent\dotnet\Telemetry\AllowListToSendFirstArgument.cs (1)
19System.CommandLine.Parsing.CommandResult commandResult => commandResult.Command.Name,
parent\dotnet\Telemetry\TelemetryFilter.cs (2)
88parseResult.CommandResult.Command != null && 89parseResult.CommandResult.Command.Name == "update")
dotnet-watch (1)
CommandLine\CommandLineOptions.cs (1)
211var definition = (DotnetWatchCommandDefinition)parseResult.CommandResult.Command;
ilc (2)
parent\parent\Common\CommandLineHelpers.cs (2)
237foreach (Option option in res.CommandResult.Command.Options) 294foreach (Argument argument in res.CommandResult.Command.Arguments)
Microsoft.DotNet.Cli.CommandLine (1)
ForwardedOptionExtensions.cs (1)
208=> parseResult.OptionValuesToBeForwarded((command ?? parseResult.CommandResult.Command).Options);
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 rootCommand = args.RootCommandResult.Command;