From 556c5327699b1b0c5ffd3bec344d3d1a3f50c827 Mon Sep 17 00:00:00 2001 From: Jezz Santos Date: Tue, 9 May 2023 19:01:46 +1200 Subject: [PATCH] Added structured output for creating code templates. #79 --- docs/authoring.md | 13 +- src/Automate.sln.DotSettings | 1 + .../Infrastructure/Api/AuthoringSpec.cs | 7 +- .../Api/AuthoringStructuredSpec.cs | 145 ++++++++++++++++++ .../Api/AuthoringApiHandlers.cs | 73 +++++++-- src/CLI/Infrastructure/Api/CommandLineApi.cs | 6 +- .../Infrastructure/OutputMessages.Designer.cs | 47 ++++-- src/CLI/Infrastructure/OutputMessages.resx | 15 +- .../Application/AuthoringApplicationSpec.cs | 4 +- .../Application/AuthoringApplication.cs | 12 +- 10 files changed, 275 insertions(+), 48 deletions(-) diff --git a/docs/authoring.md b/docs/authoring.md index 4bba632..d8a5887 100644 --- a/docs/authoring.md +++ b/docs/authoring.md @@ -473,7 +473,7 @@ automate test codetemplate "" --aschildof "{}" automate test codetemplate "ATemplateName" --aschildof "{AnElementName}" ``` -### Add code template commands +### Add code template command !!! abstract "Concept" A "Code Template Command" is simply a type of automation that executes a "Code Template". This automation must be wired up to a "Code Template", and a "Code Template" must have a "Code Template Command" wired to it, to be applied in any use-case. This kind of command is responsible for deciding how to render the "Code Template" into the target codebase (where in the codebase, and how its named). @@ -524,14 +524,17 @@ automate edit add-codetemplate-with-command "" --targetpath "" --aschildof "{" --aschildof "{}" - The `--arguments ` optionally defines the arguments to pass to the program. Double-quotes in the arguments must be escaped with double-quotes. The arguments may also contain [Templating Expressions](reference.md#templating-expressions) (relative to the element/collection of the value of `--aschildof`), which will be resolved when the command is applied. -- The `--name` optionally defines a name for the command. If none is given, a default name will be derived for the command. +- The `--name` optionally defines a name for the command. If no name is specified, an automatic name is assigned to this command. !!! example To the pattern: diff --git a/src/Automate.sln.DotSettings b/src/Automate.sln.DotSettings index c610ea3..bc49265 100644 --- a/src/Automate.sln.DotSettings +++ b/src/Automate.sln.DotSettings @@ -1193,6 +1193,7 @@ namespace $NAMESPACE$ True True True + True True True True diff --git a/src/CLI.IntegrationTests/Infrastructure/Api/AuthoringSpec.cs b/src/CLI.IntegrationTests/Infrastructure/Api/AuthoringSpec.cs index b8ac19f..772667a 100644 --- a/src/CLI.IntegrationTests/Infrastructure/Api/AuthoringSpec.cs +++ b/src/CLI.IntegrationTests/Infrastructure/Api/AuthoringSpec.cs @@ -600,12 +600,12 @@ public void WhenAddCodeTemplateWithCommand_ThenAddsTemplateAndCommand() this.setup.Should().DisplayNoError(); this.setup.Should() .DisplayOutput( - OutputMessages.CommandLine_Output_CodeTemplatedAdded.SubstituteTemplate("ATemplateName", + OutputMessages.CommandLine_Output_CodeTemplateAdded.SubstituteTemplate("ATemplateName", codeTemplate.Id, pattern.Id, codeTemplate.Metadata.OriginalFilePath, codeTemplateLocation)); this.setup.Should() .DisplayOutput( OutputMessages.CommandLine_Output_CodeTemplateCommandAdded.SubstituteTemplate( - "ATemplateNameCommand1", + "CodeTemplateCommand1", this.setup.Pattern.Automation.Single().Id, pattern.Id)); this.setup.Pattern.CodeTemplates.Should().ContainSingle(x => x.Name == "ATemplateName"); } @@ -655,7 +655,8 @@ public void WhenViewCodeTemplate_ThenViewsTemplate() this.setup.Should() .DisplayOutput( OutputMessages.CommandLine_Output_CodeTemplateContentViewed.SubstituteTemplate(codeTemplate.Name, - codeTemplate.Id, this.setup.Pattern.Id, codeTemplateLocation, content)); + codeTemplate.Id, this.setup.Pattern.Id, codeTemplate.Metadata.OriginalFilePath, + codeTemplate.Metadata.OriginalFileExtension, codeTemplateLocation, content)); } [Fact] diff --git a/src/CLI.IntegrationTests/Infrastructure/Api/AuthoringStructuredSpec.cs b/src/CLI.IntegrationTests/Infrastructure/Api/AuthoringStructuredSpec.cs index 45fa8ae..04c7dfe 100644 --- a/src/CLI.IntegrationTests/Infrastructure/Api/AuthoringStructuredSpec.cs +++ b/src/CLI.IntegrationTests/Infrastructure/Api/AuthoringStructuredSpec.cs @@ -632,6 +632,151 @@ public void WhenUpdateElement_ThenUpdatesElement() this.setup.Should().DisplayOutput(structuredOutput); } + [Fact] + public void WhenViewCodeTemplate_ThenViewsCodeTemplate() + { + this.setup.RunCommand($"{CommandLineApi.CreateCommandName} pattern APattern"); + this.setup.RunCommand( + $"{CommandLineApi.EditCommandName} add-codetemplate \"Assets/CodeTemplates/code1.code\" --name ATemplateName"); + this.setup.RunCommand( + $"{CommandLineApi.ViewCommandName} codetemplate \"ATemplateName\" --output-structured"); + + var codeTemplate = this.setup.Pattern.CodeTemplates.Single(); + var codeTemplateLocation = + this.setup.PatternStore.GetCodeTemplateLocation(this.setup.Pattern, codeTemplate.Id, "code"); + + var structuredOutput = new StructuredOutput + { + Info = new List(), + Output = new List + { + new() + { + Message = OutputMessages.CommandLine_Output_CodeTemplateContentViewed, + Values = new Dictionary + { + { "Name", codeTemplate.Name }, + { "Id", codeTemplate.Id }, + { "ParentId", this.setup.Pattern.Id }, + { "OriginalFilePath", codeTemplate.Metadata.OriginalFilePath }, + { "OriginalFileExtension", codeTemplate.Metadata.OriginalFileExtension }, + { "EditorPath", codeTemplateLocation }, + { "Output", "some code" } + } + } + } + }.ToJson(); + this.setup.Should().DisplayNoError(); + this.setup.Should().DisplayOutput(structuredOutput); + } + + [Fact] + public void WhenAddCodeTemplate_ThenAddsCodeTemplate() + { + this.setup.RunCommand($"{CommandLineApi.CreateCommandName} pattern APattern"); + this.setup.RunCommand( + $"{CommandLineApi.EditCommandName} add-codetemplate \"Assets/CodeTemplates/code1.code\" --name ATemplateName --output-structured"); + + var codeTemplate = this.setup.Pattern.CodeTemplates.Single(); + var codeTemplateLocation = + this.setup.PatternStore.GetCodeTemplateLocation(this.setup.Pattern, codeTemplate.Id, "code"); + + var structuredOutput = new StructuredOutput + { + Info = new List + { + $"Information: {OutputMessages.CommandLine_Output_Preamble_CurrentPatternInUse.SubstituteTemplate("APattern", "0.0.0")}" + }, + Output = new List + { + new() + { + Message = OutputMessages.CommandLine_Output_CodeTemplateAdded_ForStructured, + Values = new Dictionary + { + { "Name", codeTemplate.Name }, + { "Id", codeTemplate.Id }, + { "ParentId", this.setup.Pattern.Id }, + { "OriginalFilePath", codeTemplate.Metadata.OriginalFilePath }, + { "OriginalFileExtension", codeTemplate.Metadata.OriginalFileExtension }, + { "EditorPath", codeTemplateLocation } + } + } + } + }.ToJson(); + this.setup.Should().DisplayNoError(); + this.setup.Should().DisplayOutput(structuredOutput); + } + + [Fact] + public void WhenAddCodeTemplateWithCommand_ThenAddsCodeTemplateAndCommand() + { + this.setup.RunCommand($"{CommandLineApi.CreateCommandName} pattern APattern"); + this.setup.RunCommand( + $"{CommandLineApi.EditCommandName} add-codetemplate-with-command \"Assets/CodeTemplates/code1.code\" --targetpath ~/afilepath --name ATemplateName --output-structured"); + + var codeTemplate = this.setup.Pattern.CodeTemplates.Single(); + var codeTemplateLocation = + this.setup.PatternStore.GetCodeTemplateLocation(this.setup.Pattern, codeTemplate.Id, "code"); + var command = this.setup.Pattern.Automation.Single(); + + var structuredOutput = new StructuredOutput + { + Info = new List + { + $"Information: {OutputMessages.CommandLine_Output_Preamble_CurrentPatternInUse.SubstituteTemplate("APattern", "0.0.0")}" + }, + Output = new List + { + new() + { + Message = OutputMessages + .CommandLine_Output_CodeTemplateWithCommandAdded_CodeTemplate_ForStructured, + Values = new Dictionary + { + { + "CodeTemplate", new Dictionary + { + { "Name", codeTemplate.Name }, + { "Id", codeTemplate.Id }, + { "ParentId", this.setup.Pattern.Id }, + { "OriginalFilePath", codeTemplate.Metadata.OriginalFilePath }, + { "OriginalFileExtension", codeTemplate.Metadata.OriginalFileExtension }, + { "EditorPath", codeTemplateLocation } + } + } + } + }, + new() + { + Message = OutputMessages.CommandLine_Output_CodeTemplateWithCommandAdded_Command_ForStructured, + Values = new Dictionary + { + { + "Command", new Dictionary + { + { "Name", command.Name }, + { "Id", command.Id }, + { "ParentId", this.setup.Pattern.Id }, + { "Type", command.Type.ToString() }, + { + "Metadata", new Dictionary + { + { "CodeTemplateId", codeTemplate.Id }, + { "IsOneOff", false }, + { "FilePath", "~/afilepath" } + } + } + } + } + } + } + } + }.ToJson(); + this.setup.Should().DisplayNoError(); + this.setup.Should().DisplayOutput(structuredOutput); + } + public void Dispose() { this.setup.Reset(); diff --git a/src/CLI/Infrastructure/Api/AuthoringApiHandlers.cs b/src/CLI/Infrastructure/Api/AuthoringApiHandlers.cs index 175f786..4c1ba28 100644 --- a/src/CLI/Infrastructure/Api/AuthoringApiHandlers.cs +++ b/src/CLI/Infrastructure/Api/AuthoringApiHandlers.cs @@ -281,31 +281,69 @@ internal static void DeleteCollection(string name, string asChildOf) element.Id, parent.Id); } - internal static void AddCodeTemplate(string filepath, string name, string asChildOf) + internal static void AddCodeTemplate(string filepath, string name, string asChildOf, bool outputStructured) { var currentDirectory = Metadata.CurrentExecutionPath; var (parent, template) = authoring.AddCodeTemplate(currentDirectory, filepath, name, asChildOf); - Output(OutputMessages.CommandLine_Output_CodeTemplatedAdded, template.Template.Name, - template.Template.Id, - parent.Id, template.Template.Metadata.OriginalFilePath, template.Location); + if (outputStructured) + { + Output(OutputMessages.CommandLine_Output_CodeTemplateAdded_ForStructured, template.Template.Name, + template.Template.Id, parent.Id, template.Template.Metadata.OriginalFilePath, + template.Template.Metadata.OriginalFileExtension, + template.Location); + } + else + { + Output(OutputMessages.CommandLine_Output_CodeTemplateAdded, template.Template.Name, + template.Template.Id, parent.Id, template.Template.Metadata.OriginalFilePath, + template.Location); + } } - internal static void AddCodeTemplateWithCommand(string filepath, string name, bool isOneOff, - string targetPath, string asChildOf) + internal static void AddCodeTemplateWithCommand(string filepath, string name, string commandName, + bool isOneOff, + string targetPath, string asChildOf, bool outputStructured) { var currentDirectory = Metadata.CurrentExecutionPath; var (parent, template, command) = authoring.AddCodeTemplateWithCommand(currentDirectory, filepath, - name, isOneOff, targetPath, asChildOf); - Output(OutputMessages.CommandLine_Output_CodeTemplatedAdded, template.Template.Name, - template.Template.Id, parent.Id, template.Template.Metadata.OriginalFilePath, - template.Location); - Output(OutputMessages.CommandLine_Output_CodeTemplateCommandAdded, - command.Name, command.Id, parent.Id); + name, commandName, isOneOff, targetPath, asChildOf); + if (outputStructured) + { + Output(OutputMessages.CommandLine_Output_CodeTemplateWithCommandAdded_CodeTemplate_ForStructured, + JsonNode.Parse(new + { + template.Template.Name, + template.Template.Id, + ParentId = parent.Id, + template.Template.Metadata.OriginalFilePath, + template.Template.Metadata.OriginalFileExtension, + EditorPath = template.Location + }.ToJson())); + Output(OutputMessages.CommandLine_Output_CodeTemplateWithCommandAdded_Command_ForStructured, + JsonNode.Parse(new + { + command.Name, + command.Id, + ParentId = parent.Id, + Type = command.Type.ToString(), + command.Metadata + }.ToJson())); + } + else + { + Output(OutputMessages.CommandLine_Output_CodeTemplateAdded, template.Template.Name, + template.Template.Id, parent.Id, template.Template.Metadata.OriginalFilePath, + template.Location); + Output(OutputMessages.CommandLine_Output_CodeTemplateCommandAdded, + command.Name, command.Id, parent.Id); + } } - internal static void EditCodeTemplate(string templateName, string with, string args, string asChildOf) + internal static void EditCodeTemplateContent(string templateName, string with, string args, + string asChildOf) { - var (parent, template, location) = authoring.EditCodeTemplate(templateName, with, args, asChildOf); + var (parent, template, location) = + authoring.EditCodeTemplateContent(templateName, with, args, asChildOf); Output(OutputMessages.CommandLine_Output_CodeTemplateContentEdited, template.Name, template.Id, parent.Id, with, location); } @@ -340,11 +378,12 @@ internal static void DeleteCodeTemplate(string templateName, string asChildOf) test.Template.Id, test.Output); } - internal static void ViewCodeTemplate(string templateName, string asChildOf, bool outputStructured) + internal static void ViewCodeTemplateContent(string templateName, string asChildOf) { - var (parent, template, location, content) = authoring.ViewCodeTemplate(templateName, asChildOf); + var (parent, template, location, content) = authoring.ViewCodeTemplateContent(templateName, asChildOf); Output(OutputMessages.CommandLine_Output_CodeTemplateContentViewed, template.Name, template.Id, - parent.Id, location, content); + parent.Id, template.Metadata.OriginalFilePath, template.Metadata.OriginalFileExtension, location, + content); } internal static void AddCodeTemplateCommand(string codeTemplateName, string name, bool isOneOff, diff --git a/src/CLI/Infrastructure/Api/CommandLineApi.cs b/src/CLI/Infrastructure/Api/CommandLineApi.cs index 5e15b51..0fd5e3d 100644 --- a/src/CLI/Infrastructure/Api/CommandLineApi.cs +++ b/src/CLI/Infrastructure/Api/CommandLineApi.cs @@ -190,6 +190,8 @@ private static RootCommand DefineCommands() typeof(bool), () => false, ArgumentArity.ZeroOrOne), new Option("--name", "A friendly name for the code template", arity: ArgumentArity.ZeroOrOne), + new Option("--commandname", "A friendly name for the command", + arity: ArgumentArity.ZeroOrOne), new Option("--aschildof", "The expression of the element/collection to add the code template to", typeof(string), arity: ArgumentArity.ZeroOrOne) }.WithHandler(nameof(AuthoringApiHandlers.AddCodeTemplateWithCommand)), @@ -202,7 +204,7 @@ private static RootCommand DefineCommands() typeof(string), arity: ArgumentArity.ZeroOrOne), new Option("--aschildof", "The expression of the element/collection to edit the code template from", typeof(string), arity: ArgumentArity.ZeroOrOne) - }.WithHandler(nameof(AuthoringApiHandlers.EditCodeTemplate)), + }.WithHandler(nameof(AuthoringApiHandlers.EditCodeTemplateContent)), new Command("delete-codetemplate", "Deletes a code template from an element/collection in the pattern") { new Argument("TemplateName", "The name of the code template"), @@ -431,7 +433,7 @@ private static RootCommand DefineCommands() new Argument("TemplateName", "The name of the code template"), new Option("--aschildof", "The expression of the element/collection of the code template", typeof(string), arity: ArgumentArity.ZeroOrOne) - }.WithHandler(nameof(AuthoringApiHandlers.ViewCodeTemplate)), + }.WithHandler(nameof(AuthoringApiHandlers.ViewCodeTemplateContent)), new Command(ToolkitSubCommandName, "View the configuration of the current toolkit") { new Option("--all", "Include additional configuration, like automation and code templates", diff --git a/src/CLI/Infrastructure/OutputMessages.Designer.cs b/src/CLI/Infrastructure/OutputMessages.Designer.cs index 69d0092..9c7feda 100644 --- a/src/CLI/Infrastructure/OutputMessages.Designer.cs +++ b/src/CLI/Infrastructure/OutputMessages.Designer.cs @@ -141,6 +141,24 @@ internal class OutputMessages { } } + /// + /// Looks up a localized string similar to Added Code Template: '{Name}' (ID: '{Id}') to element '{ParentId}', from: '{OriginalFilePath}'. Contents can be edited in: '{EditorPath}'. + /// + internal static string CommandLine_Output_CodeTemplateAdded { + get { + return ResourceManager.GetString("CommandLine_Output_CodeTemplateAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Added Code Template: '{Name}' (ID: '{Id}') to element '{ParentId}', from: '{OriginalFilePath}' with extension '{OriginalFileExtension}'. Contents can be edited in: '{EditorPath}'. + /// + internal static string CommandLine_Output_CodeTemplateAdded_ForStructured { + get { + return ResourceManager.GetString("CommandLine_Output_CodeTemplateAdded_ForStructured", resourceCulture); + } + } + /// /// Looks up a localized string similar to Added Code Template Command: '{Name}' (ID: '{CommandId}') to element '{ParentId}'. /// @@ -197,7 +215,7 @@ internal class OutputMessages { } /// - /// Looks up a localized string similar to Viewing Code Template: '{Name}' (ID: '{Id}') on element '{ParentId}', for '{EditorPath}': + /// Looks up a localized string similar to Viewing Code Template: '{Name}' (ID: '{Id}') on element '{ParentId}', originally: '{OriginalFilePath}' with extension: '{OriginalFileExtension}', with content from '{EditorPath}': ///{Output}. /// internal static string CommandLine_Output_CodeTemplateContentViewed { @@ -206,15 +224,6 @@ internal class OutputMessages { } } - /// - /// Looks up a localized string similar to Added Code Template: '{Name}' (ID: '{Id}') to element '{ParentId}', from: '{FilePath}'. Contents can be edited in: '{EditorPath}'. - /// - internal static string CommandLine_Output_CodeTemplatedAdded { - get { - return ResourceManager.GetString("CommandLine_Output_CodeTemplatedAdded", resourceCulture); - } - } - /// /// Looks up a localized string similar to Deleted Code Template: '{Name}' (ID: '{Id}') from element '{ParentId}'. /// @@ -252,6 +261,24 @@ internal class OutputMessages { } } + /// + /// Looks up a localized string similar to Added Code Template: {CodeTemplate}. + /// + internal static string CommandLine_Output_CodeTemplateWithCommandAdded_CodeTemplate_ForStructured { + get { + return ResourceManager.GetString("CommandLine_Output_CodeTemplateWithCommandAdded_CodeTemplate_ForStructured", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Added Code Template Command: {Command}. + /// + internal static string CommandLine_Output_CodeTemplateWithCommandAdded_Command_ForStructured { + get { + return ResourceManager.GetString("CommandLine_Output_CodeTemplateWithCommandAdded_Command_ForStructured", resourceCulture); + } + } + /// /// Looks up a localized string similar to Added Collection: '{Name}' (ID: '{ElementId}') to element '{ParentId}', successfully. /// diff --git a/src/CLI/Infrastructure/OutputMessages.resx b/src/CLI/Infrastructure/OutputMessages.resx index 6f42ee9..a0b14bd 100644 --- a/src/CLI/Infrastructure/OutputMessages.resx +++ b/src/CLI/Infrastructure/OutputMessages.resx @@ -59,8 +59,14 @@ Editable patterns: {Patterns} - - Added Code Template: '{Name}' (ID: '{Id}') to element '{ParentId}', from: '{FilePath}'. Contents can be edited in: '{EditorPath}' + + Added Code Template: '{Name}' (ID: '{Id}') to element '{ParentId}', from: '{OriginalFilePath}'. Contents can be edited in: '{EditorPath}' + + + Added Code Template: '{Name}' (ID: '{Id}') to element '{ParentId}', from: '{OriginalFilePath}' with extension '{OriginalFileExtension}'. Contents can be edited in: '{EditorPath}' + + + Added Code Template: {CodeTemplate} Editing Code Template: '{Name}' (ID: '{Id}') on element '{ParentId}', with '{ApplicationPath}' from '{EditorPath}' @@ -83,7 +89,7 @@ {Output} - Viewing Code Template: '{Name}' (ID: '{Id}') on element '{ParentId}', for '{EditorPath}': + Viewing Code Template: '{Name}' (ID: '{Id}') on element '{ParentId}', originally: '{OriginalFilePath}' with extension: '{OriginalFileExtension}', with content from '{EditorPath}': {Output} @@ -151,6 +157,9 @@ Added Code Template Command: '{Name}' (ID: '{CommandId}') to element '{ParentId}' + + Added Code Template Command: {Command} + Updated Code Template Command '{Name}' (ID: '{CommandId}') on element '{ParentId}', with path: {FilePath}, and OneOff: {OneOff} diff --git a/src/Core.UnitTests/Authoring/Application/AuthoringApplicationSpec.cs b/src/Core.UnitTests/Authoring/Application/AuthoringApplicationSpec.cs index 04390ec..6daa2e7 100644 --- a/src/Core.UnitTests/Authoring/Application/AuthoringApplicationSpec.cs +++ b/src/Core.UnitTests/Authoring/Application/AuthoringApplicationSpec.cs @@ -157,12 +157,12 @@ public void WhenAddCodeTemplateWithCommand_ThenTemplateAndCommandAdded() this.store.Create(new PatternDefinition("aname")); var result = this.application.AddCodeTemplateWithCommand("arootpath", "arelativepath", "atemplatename", - false, "atargetpath", null); + "acommandname", false, "atargetpath", null); result.Template.Template.Name.Should().Be("atemplatename"); result.Template.Template.Metadata.OriginalFilePath.Should().Be("afullpath"); result.Template.Location.Should().Be(MemoryRepository.InMemoryLocation); - result.Command.Name.Should().Be("atemplatenameCommand1"); + result.Command.Name.Should().Be("acommandname"); result.Command.Type.Should().Be(AutomationType.CodeTemplateCommand); result.Command.Metadata[nameof(CodeTemplateCommand.IsOneOff)].Should().Be(false); result.Command.Metadata[nameof(CodeTemplateCommand.FilePath)].Should().Be("atargetpath"); diff --git a/src/Core/Authoring/Application/AuthoringApplication.cs b/src/Core/Authoring/Application/AuthoringApplication.cs index b2ec6c6..14f1695 100644 --- a/src/Core/Authoring/Application/AuthoringApplication.cs +++ b/src/Core/Authoring/Application/AuthoringApplication.cs @@ -221,7 +221,8 @@ public List ListPatterns() } public (IPatternElement Parent, UploadedCodeTemplate Template, Automation Command) AddCodeTemplateWithCommand( - string rootPath, string relativeFilePath, string name, bool isOneOff, string targetPath, + string rootPath, string relativeFilePath, string codeTemplateName, string commandName, bool isOneOff, + string targetPath, string parentExpression) { rootPath.GuardAgainstNullOrEmpty(nameof(rootPath)); @@ -241,14 +242,12 @@ public List ListPatterns() var target = ResolveTargetElement(pattern, parentExpression); - var codeTemplate = target.AddCodeTemplate(name, fullPath, extension); + var codeTemplate = target.AddCodeTemplate(codeTemplateName, fullPath, extension); this.store.Save(pattern); var sourceFile = this.fileResolver.GetFileAtPath(fullPath); var location = this.store.UploadCodeTemplate(pattern, codeTemplate.Id, sourceFile); - var count = target.Automation.Count + 1; - var commandName = $"{name}Command{count}"; var command = target.AddCodeTemplateCommand(commandName, codeTemplate.Name, isOneOff, targetPath); this.store.Save(pattern); @@ -256,7 +255,8 @@ public List ListPatterns() return (target, new UploadedCodeTemplate(codeTemplate, location), command); } - public (IPatternElement Parent, CodeTemplate Template, string Location) EditCodeTemplate(string templateName, + public (IPatternElement Parent, CodeTemplate Template, string Location) EditCodeTemplateContent( + string templateName, string editorPath, string arguments, string parentExpression) { @@ -284,7 +284,7 @@ public List ListPatterns() return (target, codeTemplate, location); } - public (IPatternElement Parent, CodeTemplate Template, string Location, string content) ViewCodeTemplate( + public (IPatternElement Parent, CodeTemplate Template, string Location, string content) ViewCodeTemplateContent( string templateName, string parentExpression) { templateName.GuardAgainstNullOrEmpty(nameof(templateName));