From 9c966111ec536736fdb4807801583b2a68c34b0e Mon Sep 17 00:00:00 2001 From: Aksel Kvitberg Date: Thu, 21 Mar 2024 09:57:14 +0100 Subject: [PATCH] Allow the inclusion of a {DATE} placeholder in the template files The {DATE} placeholder will be replaced by the current Date when a new ADR is created, using the users locale. --- Solutions/Endjin.Adr.Cli/Commands/New/NewAdrCommand.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Solutions/Endjin.Adr.Cli/Commands/New/NewAdrCommand.cs b/Solutions/Endjin.Adr.Cli/Commands/New/NewAdrCommand.cs index 44e1ca4..867d33a 100644 --- a/Solutions/Endjin.Adr.Cli/Commands/New/NewAdrCommand.cs +++ b/Solutions/Endjin.Adr.Cli/Commands/New/NewAdrCommand.cs @@ -135,7 +135,9 @@ private static string CreateNewDefaultTemplate(string title, ITemplateSettingsMa Regex yamlHeaderRegExp = YamlHeaderRegex(); - return yamlHeaderRegExp.Replace(templateContents, $"# {title}"); + return yamlHeaderRegExp + .Replace(templateContents, $"# {title}") + .Replace("{DATE}", DateTime.Now.ToShortDateString()); } private static async Task> GetAllAdrFilesFromCurrentDirectoryAsync(string targetPath)