76 types derived from Command
aspire (1)
Commands\BaseCommand.cs (1)
15
internal abstract class BaseCommand :
Command
cdac-build-tool (1)
ComposeCommand.cs (1)
11
internal sealed class ComposeCommand :
Command
Microsoft.DotNet.Cli.Definitions (68)
Commands\Build\BuildCommandDefinition.cs (1)
10
internal sealed class BuildCommandDefinition :
Command
Commands\BuildServer\BuildServerCommandDefinition.cs (1)
10
internal sealed class BuildServerCommandDefinition :
Command
Commands\BuildServer\BuildServerShutdownCommandDefinition.cs (1)
8
internal sealed class BuildServerShutdownCommandDefinition :
Command
Commands\Clean\CleanCommandDefinition.cs (1)
10
internal sealed class CleanCommandDefinition :
Command
Commands\Clean\CleanFileBasedAppArtifactsCommandDefinition.cs (1)
8
internal sealed class CleanFileBasedAppArtifactsCommandDefinition :
Command
Commands\Format\FormatCommandDefinition.cs (1)
9
internal sealed class FormatCommandDefinition :
Command
Commands\Fsi\FsiCommandDefinition.cs (1)
9
internal sealed class FsiCommandDefinition :
Command
Commands\Help\HelpCommandDefinition.cs (1)
9
internal sealed class HelpCommandDefinition :
Command
Commands\Hidden\Add\AddCommandDefinition.cs (1)
12
internal sealed class AddCommandDefinition :
Command
Commands\Hidden\Complete\CompleteCommandDefinition.cs (1)
8
internal sealed class CompleteCommandDefinition :
Command
Commands\Hidden\InternalReportInstallSuccess\InternalReportInstallSuccessCommandDefinition.cs (1)
8
internal sealed class InternalReportInstallSuccessCommandDefinition :
Command
Commands\Hidden\List\ListCommandDefinition.cs (1)
11
internal sealed class ListCommandDefinition :
Command
Commands\Hidden\List\ListReferenceCommandDefinition.cs (1)
25
internal abstract class ListReferenceCommandDefinitionBase :
Command
Commands\Hidden\Parse\ParseCommandDefinition.cs (1)
8
internal sealed class ParseCommandDefinition :
Command
Commands\Hidden\Remove\RemoveCommandDefinition.cs (1)
12
internal sealed class RemoveCommandDefinition :
Command
Commands\MSBuild\MSBuildCommandDefinition.cs (1)
9
internal sealed class MSBuildCommandDefinition :
Command
Commands\New\InstantiateCommandDefinition.cs (1)
8
public sealed class NewCreateCommandDefinition :
Command
Commands\New\NewAliasCommandDefinition.cs (1)
9
:
Command
(name, description)
Commands\New\NewCommandDefinition.cs (1)
11
public sealed class NewCommandDefinition :
Command
Commands\New\NewDetailsCommandDefinition.cs (1)
8
public sealed class NewDetailsCommandDefinition :
Command
Commands\New\NewInstallCommandDefinition.cs (1)
8
public sealed class NewInstallCommandDefinition :
Command
Commands\New\NewListCommandDefinition.cs (1)
8
public sealed class NewListCommandDefinition :
Command
Commands\New\NewSearchCommandDefinition.cs (1)
8
public sealed class NewSearchCommandDefinition :
Command
Commands\New\NewUninstallCommandDefinition.cs (1)
8
public sealed class NewUninstallCommandDefinition :
Command
Commands\New\NewUpdateCommandDefinition.cs (1)
8
public abstract class NewUpdateCommandDefinitionBase :
Command
Commands\NuGet\NuGetCommandDefinition.cs (8)
10
internal sealed class NuGetCommandDefinition :
Command
50
public sealed class NuGetDeleteCommandDefinition :
Command
92
public sealed class NuGetLocalsCommandDefinition :
Command
125
public sealed class NuGetPushCommandDefinition :
Command
191
public sealed class NuGetVerifyCommandDefinition :
Command
222
public sealed class NuGetTrustCommandDefinition :
Command
259
public abstract class NuGetTrustSubcommandDefinition :
Command
356
public sealed class NuGetSignCommandDefinition :
Command
Commands\Pack\PackCommandDefinition.cs (1)
12
internal sealed class PackCommandDefinition :
Command
Commands\Package\PackageAddCommandDefinition.cs (1)
18
public abstract class PackageAddCommandDefinitionBase :
Command
Commands\Package\PackageCommandDefinition.cs (1)
14
internal sealed class PackageCommandDefinition :
Command
Commands\Package\PackageListCommandDefinition.cs (1)
17
internal abstract class PackageListCommandDefinitionBase :
Command
Commands\Package\PackageRemoveCommandDefinition.cs (1)
24
internal abstract class PackageRemoveCommandDefinitionBase :
Command
Commands\Package\PackageSearchCommandDefinition.cs (1)
9
internal sealed class PackageSearchCommandDefinition :
Command
Commands\Project\ProjectCommandDefinition.cs (1)
9
internal sealed class ProjectCommandDefinition :
Command
Commands\Project\ProjectConvertCommandDefinition.cs (1)
8
internal sealed class ProjectConvertCommandDefinition :
Command
Commands\Publish\PublishCommandDefinition.cs (1)
10
internal sealed class PublishCommandDefinition :
Command
Commands\Reference\ReferenceAddCommandDefinition.cs (1)
20
internal abstract class ReferenceAddCommandDefinitionBase :
Command
Commands\Reference\ReferenceCommandDefinition.cs (1)
12
internal sealed class ReferenceCommandDefinition :
Command
Commands\Reference\ReferenceRemoveCommandDefinition.cs (1)
18
internal abstract class ReferenceRemoveCommandDefinitionBase :
Command
Commands\Restore\RestoreCommandDefinition.cs (1)
10
internal sealed class RestoreCommandDefinition :
Command
Commands\Run\RunApiCommandDefinition.cs (1)
8
internal sealed class RunApiCommandDefinition :
Command
Commands\Run\RunCommandDefinition.cs (1)
10
internal sealed class RunCommandDefinition :
Command
Commands\Sdk\SdkCheckCommandDefinition.cs (1)
9
:
Command
("check", CommandDefinitionStrings.SdkCheckAppFullName)
Commands\Sdk\SdkCommandDefinition.cs (1)
10
internal sealed class SdkCommandDefinition :
Command
Commands\Solution\SolutionAddCommandDefinition.cs (1)
8
public sealed class SolutionAddCommandDefinition :
Command
Commands\Solution\SolutionCommandDefinition.cs (1)
13
public sealed class SolutionCommandDefinition :
Command
Commands\Solution\SolutionListCommandDefinition.cs (1)
8
public sealed class SolutionListCommandDefinition :
Command
Commands\Solution\SolutionMigrateCommandDefinition.cs (1)
8
public sealed class SolutionMigrateCommandDefinition :
Command
Commands\Solution\SolutionRemoveCommandDefinition.cs (1)
8
public sealed class SolutionRemoveCommandDefinition :
Command
Commands\Test\TestCommandDefinition.cs (1)
12
internal abstract partial class TestCommandDefinition :
Command
Commands\Tool\StoreCommandDefinition.cs (1)
9
internal sealed class StoreCommandDefinition :
Command
Commands\Tool\ToolCommandDefinition.cs (1)
17
internal sealed class ToolCommandDefinition :
Command
Commands\Tool\ToolExecuteCommandDefinition.cs (1)
17
internal abstract class ToolExecuteCommandDefinitionBase :
Command
Commands\Tool\ToolListCommandDefinition.cs (1)
8
internal sealed class ToolListCommandDefinition :
Command
Commands\Tool\ToolRestoreCommandDefinition.cs (1)
8
internal sealed class ToolRestoreCommandDefinition :
Command
Commands\Tool\ToolRunCommandDefinition.cs (1)
10
internal sealed class ToolRunCommandDefinition :
Command
Commands\Tool\ToolSearchCommandDefinition.cs (1)
8
internal sealed class ToolSearchCommandDefinition :
Command
Commands\Tool\ToolUninstallCommandDefinition.cs (1)
8
internal sealed class ToolUninstallCommandDefinition :
Command
Commands\Tool\ToolUpdateInstallCommandDefinition.cs (1)
9
internal abstract class ToolUpdateInstallCommandDefinition : System.CommandLine.
Command
Commands\VSTest\VSTestCommandDefinition.cs (1)
9
internal sealed class VSTestCommandDefinition :
Command
Commands\Workload\WorkloadCommandDefinition.cs (1)
21
internal sealed class WorkloadCommandDefinition :
Command
Commands\Workload\WorkloadCommandDefinitionBase.cs (1)
10
:
Command
(name, description)
Microsoft.TemplateEngine.Cli (2)
Commands\BaseCommand.cs (1)
24
:
Command
(definition.Name, definition.Description)
Commands\create\TemplateCommand.cs (1)
18
internal class TemplateCommand :
Command
NuGet.CommandLine.XPlat (1)
Commands\DocumentedCommand.cs (1)
10
public class DocumentedCommand :
Command
System.CommandLine (1)
RootCommand.cs (1)
21
public class RootCommand :
Command
System.CommandLine.StaticCompletions (2)
CompletionsCommandDefinition.cs (1)
8
public sealed class CompletionsCommandDefinition :
Command
CompletionsGenerateScriptCommandDefinition.cs (1)
8
public sealed class CompletionsGenerateScriptCommandDefinition :
Command
30 instantiations of Command
Aspire.Cli.Tests (2)
Commands\OptionWithLegacyTests.cs (2)
16
var command = new
Command
("test");
31
var command = new
Command
("test");
aspire-managed (3)
NuGet\Commands\LayoutCommand.cs (1)
21
var command = new
Command
("layout", "Create flat DLL layout from project.assets.json");
NuGet\Commands\RestoreCommand.cs (1)
28
var command = new
Command
("restore", "Restore NuGet packages");
NuGet\Commands\SearchCommand.cs (1)
25
var command = new
Command
("search", "Search for NuGet packages");
dotnet-format (3)
Commands\FormatAnalyzersCommand.cs (1)
18
var command = new
Command
("analyzers", Resources.Run_3rd_party_analyzers__and_apply_fixes)
Commands\FormatStyleCommand.cs (1)
18
var command = new
Command
("style", Resources.Run_code_style_analyzers_and_apply_fixes)
Commands\FormatWhitespaceCommand.cs (1)
18
var command = new
Command
("whitespace", Resources.Run_whitespace_formatting)
dotnet-sourcelink (4)
Program.cs (4)
97
var test = new
Command
("test", "TODO")
119
var printJson = new
Command
("print-json", "Print Source Link JSON stored in the PDB")
125
var printDocuments = new
Command
("print-documents", "TODO")
131
var printUrls = new
Command
("print-urls", "TODO")
dotnet-suggest (4)
SuggestionDispatcher.cs (4)
25
CompleteScriptCommand = new
Command
("script", "Print complete script for specific shell")
34
ListCommand = new
Command
("list")
44
GetCommand = new
Command
("get", "Gets suggestions from the specified executable")
53
RegisterCommand = new
Command
("register", "Registers an app for suggestions")
Microsoft.DotNet.Cli.Utils (1)
MSBuildArgs.cs (1)
105
var fakeCommand = new System.CommandLine.
Command
("dotnet");
Microsoft.DotNet.MacOsPkg.Cli (3)
Program.cs (3)
43
var unpackCommand = new
Command
("unpack", "Unpack a .pkg or .app file")
56
var packCommand = new
Command
("pack", "Pack a directory into a .pkg or .app file.")
68
var verifyCommand = new
Command
("verify", "Verify that a pkg or app is signed.")
Microsoft.DotNet.VersionTools.Cli (1)
Program.cs (1)
40
System.CommandLine.Command trimAssetVersionCommand =
new
("trim-assets-version", "Trim versions from provided assets. Currently, only NuGet packages are supported.");
Microsoft.Extensions.AI.Evaluation.Console (3)
Program.cs (3)
56
var reportCmd = new
Command
("report", "Generate a report from a result store");
132
var cleanResultsCmd = new
Command
("clean-results", "Delete results");
149
var cleanCacheCmd = new
Command
("clean-cache", "Delete expired cache entries");
Microsoft.NET.Sdk.BlazorWebAssembly.Tool (1)
Program.cs (1)
16
Command brotli =
new
("brotli");
Microsoft.NET.Sdk.StaticWebAssets.Tool (1)
Program.cs (1)
16
Command brotli =
new
("brotli");
Microsoft.TemplateEngine.Cli (1)
Commands\create\InstantiateCommand.NoMatchHandling.cs (1)
177
Command reparseCommand =
new
("reparse-only")
NuGet.CommandLine.XPlat (3)
NuGetCommands.cs (1)
32
packageCommand = new
Command
("package");
Program.cs (2)
116
var packageCommand = new
Command
("package");
127
var nugetCommand = new
Command
("nuget");
327 references to Command
aspire (28)
Backchannel\AuxiliaryBackchannelMonitor.cs (1)
142
var
command = await executionContext.CommandSelected.Task.WaitAsync(combined.Token).ConfigureAwait(false);
CliExecutionContext.cs (3)
54
private
Command
? _command;
59
public
Command
? Command
75
public TaskCompletionSource<
Command
> CommandSelected { get; } = new();
Commands\AppHostLauncher.cs (1)
57
internal static void AddLaunchOptions(
Command
command)
Commands\GroupedHelpAction.cs (1)
15
internal sealed class GroupedHelpAction(
Command
rootCommand, IAnsiConsole ansiConsole) : SynchronousCommandLineAction
Commands\GroupedHelpWriter.cs (7)
33
public static void WriteHelp(
Command
command, TextWriter writer, int? maxWidth = null)
51
var ungroupedCommands = new List<
Command
>();
53
foreach (
var
sub in command.Subcommands)
96
foreach (
var
cmd in ungroupedCommands)
133
foreach (
var
cmd in ungroupedCommands.OrderBy(c => c.Name, StringComparer.OrdinalIgnoreCase))
255
private static string FormatCommandLabel(
Command
cmd)
261
private static string GetArgumentSyntax(
Command
cmd)
NuGet\NuGetPackagePrefetcher.cs (7)
9
using SystemCommand = System.CommandLine.
Command
;
18
var
command = await WaitForCommandSelectionAsync(stoppingToken);
71
private async Task<
SystemCommand
?> WaitForCommandSelectionAsync(CancellationToken cancellationToken)
80
var
command = await executionContext.CommandSelected.Task.WaitAsync(combined.Token);
90
private static bool ShouldPrefetchTemplatePackages(
SystemCommand
? command)
103
private static bool ShouldPrefetchCliPackages(
SystemCommand
? command)
115
private static bool IsRuntimeOnlyCommand(
SystemCommand
command)
Templating\CallbackTemplate.cs (2)
12
Action<
Command
> applyOptionsCallback,
30
public void ApplyOptions(
Command
command)
Templating\CliTemplateFactory.cs (1)
158
private static void AddOptionIfMissing(System.CommandLine.
Command
command, System.CommandLine.Option option)
Templating\DotNetTemplateFactory.cs (4)
419
private void ApplyExtraAspireStarterOptions(
Command
command)
428
private void ApplyExtraAspireJsFrontendStarterOptions(
Command
command)
435
private void ApplyDevLocalhostTldOption(
Command
command)
440
private static void AddOptionIfMissing(
Command
command, Option option)
Templating\ITemplate.cs (1)
47
void ApplyOptions(
Command
command);
Aspire.Cli.Tests (12)
Commands\McpCommandTests.cs (9)
64
var
mcpCommand = rootCommand.Subcommands.FirstOrDefault(c => c.Name == "mcp");
78
var
mcpCommand = rootCommand.Subcommands.FirstOrDefault(c => c.Name == "mcp");
81
var
startCommand = mcpCommand.Subcommands.FirstOrDefault(c => c.Name == "start");
94
var
mcpCommand = rootCommand.Subcommands.FirstOrDefault(c => c.Name == "mcp");
165
var
agentCommand = rootCommand.Subcommands.FirstOrDefault(c => c.Name == "agent");
180
var
agentCommand = rootCommand.Subcommands.FirstOrDefault(c => c.Name == "agent");
183
var
mcpCommand = agentCommand.Subcommands.FirstOrDefault(c => c.Name == "mcp");
196
var
agentCommand = rootCommand.Subcommands.FirstOrDefault(c => c.Name == "agent");
199
var
initCommand = agentCommand.Subcommands.FirstOrDefault(c => c.Name == "init");
Commands\OptionWithLegacyTests.cs (2)
16
var
command = new Command("test");
31
var
command = new Command("test");
Commands\RootCommandTests.cs (1)
461
foreach (
var
sub in visibleCommands)
aspire-managed (6)
NuGet\Commands\LayoutCommand.cs (2)
19
public static
Command
Create()
21
var
command = new Command("layout", "Create flat DLL layout from project.assets.json");
NuGet\Commands\RestoreCommand.cs (2)
26
public static
Command
Create()
28
var
command = new Command("restore", "Restore NuGet packages");
NuGet\Commands\SearchCommand.cs (2)
23
public static
Command
Create()
25
var
command = new Command("search", "Search for NuGet packages");
dotnet (30)
CliSchema.cs (6)
14
using Command = System.CommandLine.
Command
;
82
var
command = parseResult.CommandResult.Command;
106
private static RootCommandDetails CreateRootCommandDetails(
Command
command)
152
private static Dictionary<string, CommandDetails>? CreateSubcommandsDictionary(IList<
Command
> subcommands)
159
foreach (
var
subcommand in subcommands.OrderBy(c => c.Name, StringComparer.OrdinalIgnoreCase))
177
private static CommandDetails CreateCommandDetails(
Command
subCommand) => new CommandDetails(
CommandBase.cs (1)
32
where TDefinition :
Command
Commands\DotNetCommandFactory.cs (2)
38
var
command = Parser.GetBuiltInCommand(commandName);
50
System.CommandLine.
Command
commandDefinition,
Commands\New\NewCommandParser.cs (2)
19
using Command = System.CommandLine.
Command
;
30
public static
Command
ConfigureCommand(NewCommandDefinition definition)
Commands\NuGet\NuGetCommandParser.cs (2)
10
public static void ConfigureCommand(
Command
command)
14
foreach (
var
subcommand in command.Subcommands)
Commands\Test\MTP\MicrosoftTestingPlatformTestCommand.Help.cs (6)
56
private static IEnumerable<string> GetCustomUsageParts(
Command
command, bool showOptions = true, bool showPlatformOptions = true, bool showExtensionOptions = true)
58
var parentCommands = new List<
Command
>();
59
var
nextCommand = command;
63
nextCommand = nextCommand.Parents.FirstOrDefault(c => c is
Command
) as
Command
;
67
foreach (
var
parentCommand in parentCommands)
Commands\Workload\WorkloadCommandParser.cs (1)
20
using Command = System.CommandLine.
Command
;
Parser.cs (9)
94
using Command = System.CommandLine.
Command
;
192
public static
Command
? GetBuiltInCommand(string commandName) =>
341
var
command = context.Command;
395
Command
? listCommand = command.Parents.Single() as
Command
;
426
private static bool IsInNuGetCommandTree(
Command
command)
428
Command
? current = command;
435
current = current.Parents.FirstOrDefault(p => p is
Command
) as
Command
;
ParserOptionActions.cs (1)
97
var
command = parseResult.CommandResult.Command;
dotnet-format (7)
Commands\FormatAnalyzersCommand.cs (2)
16
internal static
Command
GetCommand()
18
var
command = new Command("analyzers", Resources.Run_3rd_party_analyzers__and_apply_fixes)
Commands\FormatCommandCommon.cs (1)
118
public static void AddCommonOptions(this
Command
command)
Commands\FormatStyleCommand.cs (2)
16
internal static
Command
GetCommand()
18
var
command = new Command("style", Resources.Run_code_style_analyzers_and_apply_fixes)
Commands\FormatWhitespaceCommand.cs (2)
16
internal static
Command
GetCommand()
18
var
command = new Command("whitespace", Resources.Run_whitespace_formatting)
dotnet-sourcelink (4)
Program.cs (4)
97
var
test = new Command("test", "TODO")
119
var
printJson = new Command("print-json", "Print Source Link JSON stored in the PDB")
125
var
printDocuments = new Command("print-documents", "TODO")
131
var
printUrls = new Command("print-urls", "TODO")
dotnet-suggest (4)
SuggestionDispatcher.cs (4)
76
private
Command
CompleteScriptCommand { get; }
78
private
Command
GetCommand { get; }
92
private
Command
ListCommand { get; }
100
private
Command
RegisterCommand { get; }
dotnet-watch (5)
CommandLine\CommandLineOptions.cs (5)
54
public required
Command
Command { get; init; }
77
var
command = GetSubcommand(parseResult, out bool isExplicitCommand);
197
Command
command,
331
private static
Command
GetSubcommand(ParseResult parseResult, out bool isExplicit)
343
if (knownCommandsByName.TryGetValue(parseResult.UnmatchedTokens[i], out
var
explicitCommand))
Microsoft.DotNet.Cli.CommandLine (2)
ForwardedOptionExtensions.cs (2)
207
public IEnumerable<string> OptionValuesToBeForwarded(
Command
? command = null)
224
public IEnumerable<string> ForwardedOptionValues(
Command
command, string alias)
Microsoft.DotNet.Cli.Definitions (29)
Commands\Clean\CleanCommandDefinition.cs (1)
46
public readonly
Command
FileBasedAppsCommand = new CleanFileBasedAppArtifactsCommandDefinition();
Commands\New\CommandDefinitionExtensions.cs (3)
12
where TDefinition :
Command
29
where TDefinition :
Command
51
where TDefinition :
Command
Commands\Package\PackageCommandDefinition.cs (1)
10
using Command = System.CommandLine.
Command
;
Commands\Test\TestCommandDefinition.cs (1)
8
using Command = System.CommandLine.
Command
;
Commands\Workload\WorkloadCommandDefinition.cs (1)
17
using Command = System.CommandLine.
Command
;
Help\HelpBuilder.cs (9)
191
if (symbol is Option or
Command
)
209
: Default.GetCommandUsageLabel((
Command
)symbol));
268
case
Command
command:
385
private string GetUsage(
Command
command)
393
IEnumerable<
Command
> parentCommands =
394
RecurseWhileNotNull(command, c => c.Parents.OfType<
Command
>().FirstOrDefault())
397
foreach (
var
parentCommand in parentCommands)
433
private IEnumerable<TwoColumnHelpRow> GetCommandArgumentRows(
Command
command, HelpContext context) =>
434
RecurseWhileNotNull(command, c => c.Parents.OfType<
Command
>().FirstOrDefault())
Help\HelpBuilder.Default.cs (6)
91
public static string GetCommandUsageLabel(
Command
symbol)
94
/// <inheritdoc cref="GetCommandUsageLabel(
Command
)"/>
175
Command
? current = ctx.Command;
178
Command
? parentCommand = null;
181
if ((parentCommand = parent as
Command
) is not null)
215
/// Writes a help section describing a command's additional arguments, typically shown only when <see cref="
Command
.TreatUnmatchedTokensAsErrors"/> is set to <see langword="true"/>.
Help\HelpContext.cs (2)
17
Command
command,
31
public
Command
Command { get; } = command ?? throw new ArgumentNullException(nameof(command));
Help\ICustomHelp.cs (1)
9
/// If <see cref="
Command
"/> implements this interface, it can create custom help
Utilities\CommandExtensions.cs (4)
10
public static
Command
GetRootCommand(this
Command
command)
11
=> command.Parents.FirstOrDefault(p => p is
Command
) is
Command
parentCommand ? GetRootCommand(parentCommand) : command;
Microsoft.DotNet.Cli.Utils (1)
MSBuildArgs.cs (1)
105
var
fakeCommand = new System.CommandLine.Command("dotnet");
Microsoft.DotNet.MacOsPkg.Cli (3)
Program.cs (3)
43
var
unpackCommand = new Command("unpack", "Unpack a .pkg or .app file")
56
var
packCommand = new Command("pack", "Pack a directory into a .pkg or .app file.")
68
var
verifyCommand = new Command("verify", "Verify that a pkg or app is signed.")
Microsoft.DotNet.VersionTools.Cli (1)
Program.cs (1)
40
System.CommandLine.
Command
trimAssetVersionCommand = new("trim-assets-version", "Trim versions from provided assets. Currently, only NuGet packages are supported.");
Microsoft.Extensions.AI.Evaluation.Console (3)
Program.cs (3)
56
var
reportCmd = new Command("report", "Generate a report from a result store");
132
var
cleanResultsCmd = new Command("clean-results", "Delete results");
149
var
cleanCacheCmd = new Command("clean-cache", "Delete expired cache entries");
Microsoft.NET.Sdk.BlazorWebAssembly.Tool (1)
Program.cs (1)
16
Command
brotli = new("brotli");
Microsoft.NET.Sdk.StaticWebAssets.Tool (1)
Program.cs (1)
16
Command
brotli = new("brotli");
Microsoft.TemplateEngine.Cli (57)
Commands\BaseCommand.cs (8)
19
using Command = System.CommandLine.
Command
;
25
where TDefinition :
Command
29
protected static readonly Dictionary<string, Func<Func<ParseResult, ITemplateEngineHost>,
Command
,
Command
>> SubcommandFactories = new()
72
where TDefinition :
Command
87
foreach (
var
subcommandDef in definition.Subcommands)
136
where TDeprecatedCommand :
Command
137
where TNewCommand :
Command
Commands\BaseFilterableArgs.cs (1)
10
where TDefinition :
Command
Commands\create\InstantiateCommand.cs (1)
414
System.CommandLine.
Command
parser = ParserFactory.CreateParser(command);
Commands\create\InstantiateCommand.Help.cs (12)
12
using Command = System.CommandLine.
Command
;
369
internal static void ShowUsage(
Command
? command, IReadOnlyList<string> shortNames, HelpContext context)
378
command = command.Parents.FirstOrDefault(c => c is
Command
) as
Command
;
442
private static void WriteCustomInstantiateHelp(HelpContext context,
Command
command)
462
private static void CustomUsageSection(HelpContext context,
Command
command)
475
Command
command,
480
List<
Command
> parentCommands = new();
481
Command
? nextCommand = command;
485
nextCommand = nextCommand.Parents.FirstOrDefault(c => c is
Command
) as
Command
;
489
foreach (
Command
parentCommand in parentCommands)
Commands\create\InstantiateCommand.NoMatchHandling.cs (2)
10
using Command = System.CommandLine.
Command
;
177
Command
reparseCommand = new("reparse-only")
Commands\create\InstantiateCommand.TabCompletion.cs (1)
63
System.CommandLine.
Command
parser = ParserFactory.CreateParser(command);
Commands\create\InstantiateCommandArgs.cs (1)
71
public
Command
NewOrInstantiateCommand => ParseResult.CommandResult.Command;
Commands\create\TemplateCommand.cs (5)
14
using Command = System.CommandLine.
Command
;
24
private readonly
Command
_instantiateCommand;
33
Command
instantiateCommand,
295
static void AddReservedNamesAndAliases(HashSet<string> reservedAliases,
Command
command)
305
foreach (
Command
subCommand in command.Subcommands)
Commands\create\TemplateCommandArgs.cs (6)
14
public TemplateCommandArgs(TemplateCommand command,
Command
parentCommand, ParseResult parseResult)
83
public
Command
Command => _command;
87
public
Command
ParentCommand { get; }
126
private NewCommand GetRootCommand(
Command
command)
132
Command
? currentCommand = command;
135
currentCommand = currentCommand.Parents.OfType<
Command
>().SingleOrDefault();
Commands\Example.cs (17)
12
internal static Example<T> For<T>(ParseResult parseResult) where T :
Command
37
Command
? nextCommand = siblingCommand;
41
nextCommand = nextCommand.Parents.OfType<
Command
>().FirstOrDefault();
47
private static T SearchForSiblingCommand<T>(
Command
currentCommand) where T :
Command
49
Command
? next = currentCommand;
50
Command
root = currentCommand;
55
next = next?.Parents.OfType<
Command
>().FirstOrDefault();
58
Queue<
Command
> probes = new();
62
Command
current = probes.Dequeue();
67
foreach (
var
child in current.Subcommands)
75
internal static Example<T> FromExistingTokens<T>(ParseResult parseResult) where T :
Command
91
where T :
Command
126
where TSubcommand :
Command
132
public Example<TSubcommand> WithSubcommand<TSubcommand>() where TSubcommand :
Command
140
internal Example<
Command
> WithSubcommand(string token)
142
var
subcommand = currentCommand.Subcommands.FirstOrDefault(c => c.Name.Equals(token) || c.Aliases.Contains(token))
Commands\ParserFactory.cs (2)
16
internal static
Command
CreateParser(
Command
command, bool disableHelp = false)
NewCommandFactory.cs (1)
12
public static
Command
Create(Func<ParseResult, ICliTemplateEngineHost> hostBuilder, NewCommandDefinition definition)
NuGet.CommandLine.XPlat (20)
Commands\ConfigCommands\ConfigCommand.cs (6)
89
internal static
Command
Register(
Command
app, Func<ILogger> getLogger)
133
private static void RegisterOptionsForCommandConfigPaths(
Command
cmd, Func<ILogger> getLogger)
150
private static void RegisterOptionsForCommandConfigGet(
Command
cmd, Func<ILogger> getLogger)
172
private static void RegisterOptionsForCommandConfigSet(
Command
cmd, Func<ILogger> getLogger)
193
private static void RegisterOptionsForCommandConfigUnset(
Command
cmd, Func<ILogger> getLogger)
Commands\Package\Download\PackageDownloadCommand.cs (2)
16
internal static void Register(
Command
packageCommand, Option<bool> interactiveOption)
21
public static void Register(
Command
packageCommand, Option<bool> interactiveOption, Func<PackageDownloadArgs, CancellationToken, Task<int>> action)
Commands\Package\Update\PackageUpdateCommand.cs (2)
18
internal static void Register(
Command
packageCommand, Option<bool> interactiveOption, IVirtualProjectBuilder? virtualProjectBuilder = null)
23
internal static void Register(
Command
packageCommand, Option<bool> interactiveOption, Func<PackageUpdateArgs, CancellationToken, Task<int>> action)
Commands\PackageSearch\PackageSearchCommand.cs (2)
21
public static void Register(
Command
rootCommand, Func<ILoggerWithColor> getLogger)
26
public static void Register(
Command
rootCommand, Func<ILoggerWithColor> getLogger, Func<PackageSearchArgs, string, CancellationToken, Task<int>> setupSettingsAndRunSearchAsync)
Commands\Why\WhyCommand.cs (5)
29
internal static void Register(
Command
rootCommand, Lazy<IAnsiConsole> console, IVirtualProjectBuilder? virtualProjectBuilder = null)
41
public static void GetWhyCommand(
Command
rootCommand, IVirtualProjectBuilder? virtualProjectBuilder = null)
49
public static void GetWhyCommand(
Command
rootCommand)
54
internal static void Register(
Command
rootCommand, Lazy<IAnsiConsole> console, Func<WhyCommandRunner> getCommandRunner)
61
internal static void Register(
Command
rootCommand, Lazy<IAnsiConsole> console, Func<WhyCommandArgs, Task<int>> action)
NuGetCommands.cs (1)
29
var
packageCommand = rootCommand.Subcommands.FirstOrDefault(c => c.Name == "package");
Program.cs (2)
116
var
packageCommand = new Command("package");
127
var
nugetCommand = new Command("nuget");
System.CommandLine (75)
Argument.cs (3)
13
/// A symbol defining a value that can be passed on the command line to a <see cref="
Command
">command</see> or <see cref="Option">option</see>.
143
var
command = Parents.FlattenBreadthFirst(x => x.Parents)
144
.OfType<
Command
>()
ArgumentArity.cs (2)
152
return parent is
Command
157
if (parent is
Command
&&
ChildSymbolList{T}.cs (2)
15
private readonly
Command
_parent;
17
public ChildSymbolList(
Command
parent)
Command.cs (7)
30
private ChildSymbolList<
Command
>? _subcommands;
48
foreach (
var
command in Subcommands)
79
public IList<
Command
> Subcommands => _subcommands ??= new(this);
229
/// Adds a <see cref="
Command
"/> to the command.
232
public void Add(
Command
command) => Subcommands.Add(command);
308
Command
parentCommand = (
Command
)parent.Symbol;
Help\HelpBuilder.cs (9)
113
public void Write(
Command
command, TextWriter writer)
118
private string GetUsage(
Command
command)
126
IEnumerable<
Command
> parentCommands =
128
.RecurseWhileNotNull(c => c.Parents.OfType<
Command
>().FirstOrDefault())
131
foreach (
var
parentCommand in parentCommands)
167
private IEnumerable<TwoColumnHelpRow> GetCommandArgumentRows(
Command
command, HelpContext context) =>
169
.RecurseWhileNotNull(c => c.Parents.OfType<
Command
>().FirstOrDefault())
413
if (symbol is Option or
Command
)
431
: Default.GetCommandUsageLabel((
Command
)symbol));
Help\HelpBuilder.Default.cs (6)
127
public static string GetCommandUsageLabel(
Command
symbol)
130
/// <inheritdoc cref="GetCommandUsageLabel(
Command
)"/>
247
Command
? current = ctx.Command;
250
Command
? parentCommand = null;
253
if ((parentCommand = parent as
Command
) is not null)
287
/// Writes a help section describing a command's additional arguments, typically shown only when <see cref="
Command
.TreatUnmatchedTokensAsErrors"/> is set to <see langword="true"/>.
Help\HelpBuilderExtensions.cs (1)
17
case
Command
command:
Help\HelpContext.cs (2)
18
Command
command,
34
public
Command
Command { get; }
Help\HelpOption.cs (2)
16
/// When added to a <see cref="
Command
"/>, it configures the application to show help when one of the following options are specified on the command line:
30
/// When added to a <see cref="
Command
"/>, it configures the application to show help when given name or one of the aliases are specified on the command line.
Invocation\ParseErrorAction.cs (3)
116
Command
targetSymbol = commandResult.Command;
121
? targetSymbol.Children.Where(x => !x.Hidden && x is Option or
Command
)
133
AliasSet? aliasSet = symbol is Option option ? option._aliases : ((
Command
)symbol)._aliases;
ParseResult.cs (1)
191
public CommandResult? GetResult(
Command
command) =>
Parsing\ArgumentResult.cs (1)
87
throw new NotSupportedException($"{nameof(OnlyTake)} is supported only for a {nameof(
Command
)}-owned {nameof(ArgumentResult)}");
Parsing\CommandLineParser.cs (3)
21
public static ParseResult Parse(
Command
command, IReadOnlyList<string> args, ParserConfiguration? configuration = null)
32
public static ParseResult Parse(
Command
command, string commandLine, ParserConfiguration? configuration = null)
139
Command
command,
Parsing\CommandResult.cs (2)
15
Command
command,
28
public
Command
Command { get; }
Parsing\ParseDiagramAction.cs (1)
72
argumentResult.Argument.FirstParent!.Symbol is
Command
{ HasArguments: true, Arguments.Count: > 1 };
Parsing\ParseOperation.cs (5)
23
private readonly
Command
_rootCommand;
27
Command
rootCommand,
79
Command
command = (
Command
)CurrentToken.Symbol!;
465
if (symbol is
Command
{ Action: { } commandAction } command)
Parsing\StringExtensions.cs (12)
30
Command
rootCommand,
40
var
currentCommand = rootCommand;
144
Command
cmd = (
Command
)token.Symbol!;
183
Token CommandArgument(string value,
Command
command) => new(value, TokenType.Argument, command, i);
187
Token Command(string value,
Command
cmd) => new(value, TokenType.Command, cmd, i);
269
private static bool FirstArgumentIsRootCommand(IReadOnlyList<string> args,
Command
rootCommand, bool inferRootCommand)
380
private static Dictionary<string, Token> ValidTokens(this
Command
command)
415
Command
? current = command;
418
Command
? parentCommand = null;
422
if ((parentCommand = parent.Symbol as
Command
) is not null)
445
static void AddCommandTokens(Dictionary<string, Token> tokens,
Command
cmd)
Parsing\SymbolResult.cs (1)
77
public CommandResult? GetResult(
Command
command) => SymbolResultTree.GetResult(command);
Parsing\SymbolResultTree.cs (6)
10
private readonly
Command
? _rootCommand;
16
Command
? rootCommand = null,
37
internal CommandResult? GetResult(
Command
command)
105
private void PopulateSymbolsByName(
Command
command)
127
var
childCommand = command.Subcommands[i];
133
void AddToSymbolsByName(Symbol symbol,
Command
parent)
Parsing\TokenType.cs (1)
20
/// <see cref="CommandLine.
Command
"/>
RootCommand.cs (1)
19
/// use any subcommands. See <see cref="
Command
"/> for applications with multiple actions.
SymbolNode.cs (2)
8
internal SymbolNode(Symbol symbol,
Command
? parent = null)
16
internal
Command
? Parent { get; }
VersionOption.cs (2)
22
/// When added to a <see cref="
Command
"/>, it enables the use of a <c>--version</c> option, which, when specified in command line input, short circuits normal command handling and instead writes out version information before exiting.
32
/// When added to a <see cref="
Command
"/>, it enables the use of a provided option name and aliases, which, when specified in command line input, short circuits normal command handling and instead writes out version information before exiting.
System.CommandLine.StaticCompletions (38)
HelpGenerationExtensions.cs (7)
18
public static string FunctionName(this
Command
command, string[]? parentCommandNames = null) => parentCommandNames switch
64
public static string[] Names(this
Command
command)
76
public static IEnumerable<Option> HierarchicalOptions(this
Command
c)
87
return myOptions.Concat(c.Parents.OfType<
Command
>().SelectMany(OptionsForParent)).DistinctBy(o => o.Name);
91
private static IEnumerable<Option> OptionsForParent(
Command
c)
100
foreach (
var
p in c.Parents.OfType<
Command
>())
shells\BashShellProvider.cs (4)
21
public string GenerateCompletions(
Command
command)
33
private string GenerateCommandsCompletions(string[] parentCommandNames,
Command
command, bool isNestedCommand)
102
foreach (
var
subcommand in visibleSubcommands)
161
internal static string? GenerateOptionHandlers(
Command
command)
shells\FishShellProvider.cs (11)
21
public string GenerateCompletions(
Command
command)
32
var states = new List<(int id,
Command
cmd)>();
61
private static void CollectStates(
Command
cmd, List<(int id,
Command
cmd)> states)
64
foreach (
var
sub in cmd.Subcommands.Where(c => !c.Hidden))
90
private static void WriteStateWalker(IndentedTextWriter writer, List<(int id,
Command
cmd)> states, Dictionary<
Command
, int> stateIdByCommand)
118
foreach (
var
sub in visibleSubs)
211
private static void WriteOptionValueCompletions(IndentedTextWriter writer, List<(int id,
Command
cmd)> states)
314
private static void WriteStateCompletions(IndentedTextWriter writer, List<(int id,
Command
cmd)> states)
325
foreach (
var
sub in cmd.Subcommands.Where(c => !c.Hidden))
shells\NuShellShellProvider.cs (1)
48
public string GenerateCompletions(System.CommandLine.
Command
command) => _dynamicCompletionScript;
shells\PowershellShellProvider.cs (5)
22
public string GenerateCompletions(
Command
command)
147
internal static void GenerateSubcommandCompletions(string[] parentCommandNames, IndentedTextWriter writer,
Command
command)
160
foreach (
var
subcommand in command.Subcommands)
174
private static void GenerateStaticCompletionsForCommand(string[] commandPath,
Command
command, IndentedTextWriter writer)
188
foreach (
var
subcommand in command.Subcommands)
shells\ShellProvider.cs (1)
32
string GenerateCompletions(System.CommandLine.
Command
command);
shells\ZshShellProvider.cs (9)
20
public string GenerateCompletions(
Command
command)
78
private static void GenerateOptionsAndArgumentsForCommand(string[] commandPathForThisCommand,
Command
command, IndentedTextWriter writer)
181
private static void GenerateSubcommandList(string[] pathToCurrentCommand,
Command
command, IndentedTextWriter writer)
196
var parentArguments = command.Parents.OfType<
Command
>().SelectMany(parent => parent.Arguments).Select(arg => arg.Name).ToHashSet();
204
foreach (
var
subcommand in command.Subcommands.Where(c => !c.Hidden))
243
private static void GenerateSubcommandHandlers(string[] pathToThisCommand,
Command
command, IndentedTextWriter writer)
256
foreach (
var
subcommand in command.Subcommands.Where(s => !s.Hidden))
273
foreach (
var
subcommand in command.Subcommands.Where(c => !c.Hidden))
375
private static string[] AppendCommandToPath(string[] path,
Command
command) =>