public ListCommandCommandSource(RootCommandSource root, NewCommandCommandSource parent) : base(new Command("list", "Lists templates containing the specified template name.If no name is specified, lists all templates."), parent) { ColumnsOption = GetColumnsOption(); Command.Add(ColumnsOption); TypeOption = GetTemplateTypeOption(); Command.Add(TypeOption); LanguageOption = GetLanguageOption(); Command.Add(LanguageOption); Command.Handler = CommandHandler.Create((InvocationContext context) => { root.CurrentCommandSource = this; var result = new ListCommandCommandSourceResult(context.ParseResult, this, 0); result.Run(); return(0); }); }
public DotnetCommandCommandSource(RootCommandSource?root, CommandSourceBase?parent) : base(new Command("dotnet", "Access commands in support of .NET"), parent) { if (root is not null && root != this) { throw new InvalidOperationException(); } NewCommandCommand = new NewCommandCommandSource(this, this); Command.AddCommand(NewCommandCommand.Command); Help2Option = GetHelp2Option(); Command.Add(Help2Option); UxLevelOption = GetUxLevelOption(); Command.Add(UxLevelOption); RenderToOption = GetRenderToOption(); Command.Add(RenderToOption); Command.Handler = CommandHandler.Create((InvocationContext context) => { CurrentCommandSource = this; CurrentParseResult = context.ParseResult; var result = new DotnetCommandCommandSourceResult(context.ParseResult, this, 0); result.Run(); return(0); }); }