diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/CommandDefinitions/CollectionExtensions.cs b/src/Cli/Microsoft.TemplateEngine.Cli/CommandDefinitions/CollectionExtensions.cs new file mode 100644 index 000000000000..e6fdd134c22d --- /dev/null +++ b/src/Cli/Microsoft.TemplateEngine.Cli/CommandDefinitions/CollectionExtensions.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.TemplateEngine.Cli; + +internal static class CollectionExtensions +{ + public static void AddRange(this ICollection collection, IEnumerable items) + { + foreach (T item in items) + { + collection.Add(item); + } + } +} diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/CommandDefinitions/CommandDefinition.cs b/src/Cli/Microsoft.TemplateEngine.Cli/CommandDefinitions/CommandDefinition.cs new file mode 100644 index 000000000000..a65d0a8d2009 --- /dev/null +++ b/src/Cli/Microsoft.TemplateEngine.Cli/CommandDefinitions/CommandDefinition.cs @@ -0,0 +1,516 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#pragma warning disable CA1810 // Initialize reference type static fields inline + +using System.CommandLine; +using Microsoft.TemplateEngine.Cli.Commands; + +namespace Microsoft.TemplateEngine.Cli; + +internal class CommandDefinition(string name, string description) : Command(name, description) +{ + public static class New + { + public static readonly Option DebugCustomSettingsLocationOption = new("--debug:custom-hive") + { + Description = SymbolStrings.Option_Debug_CustomSettings, + Hidden = true, + Recursive = true + }; + + public static readonly Option DebugVirtualizeSettingsOption = new("--debug:ephemeral-hive", "--debug:virtual-hive") + { + Description = SymbolStrings.Option_Debug_VirtualSettings, + Hidden = true, + Recursive = true + }; + + public static readonly Option DebugAttachOption = new("--debug:attach") + { + Description = SymbolStrings.Option_Debug_Attach, + Hidden = true, + Recursive = true + }; + + public static readonly Option DebugReinitOption = new("--debug:reinit") + { + Description = SymbolStrings.Option_Debug_Reinit, + Hidden = true, + Recursive = true + }; + + public static readonly Option DebugRebuildCacheOption = new("--debug:rebuild-cache", "--debug:rebuildcache") + { + Description = SymbolStrings.Option_Debug_RebuildCache, + Hidden = true, + Recursive = true + }; + + public static readonly Option DebugShowConfigOption = new("--debug:show-config", "--debug:showconfig") + { + Description = SymbolStrings.Option_Debug_ShowConfig, + Hidden = true, + Recursive = true + }; + + public static readonly Argument ShortNameArgument = new("template-short-name") + { + Description = SymbolStrings.Command_Instantiate_Argument_ShortName, + Arity = new ArgumentArity(0, 1), + Hidden = true + }; + + public static readonly Argument RemainingArguments = new("template-args") + { + Description = SymbolStrings.Command_Instantiate_Argument_TemplateOptions, + Arity = new ArgumentArity(0, 999), + Hidden = true + }; + + public static readonly Option InteractiveOption = SharedOptionsFactory.CreateInteractiveOption().AsHidden(); + + public static readonly Option AddSourceOption = SharedOptionsFactory.CreateAddSourceOption().AsHidden().DisableAllowMultipleArgumentsPerToken(); + + public static readonly Option ColumnsAllOption = SharedOptionsFactory.CreateColumnsAllOption().AsHidden(); + + public static readonly Option ColumnsOption = SharedOptionsFactory.CreateColumnsOption().AsHidden().DisableAllowMultipleArgumentsPerToken(); + + public static IReadOnlyList