Skip to content

Commit

Permalink
Allow the inclusion of a {DATE} placeholder in the template files
Browse files Browse the repository at this point in the history
The {DATE} placeholder will be replaced by the current Date when a new ADR is created, using the users locale.
  • Loading branch information
akselkvitberg committed Mar 21, 2024
1 parent 966c88c commit 9c96611
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Solutions/Endjin.Adr.Cli/Commands/New/NewAdrCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<Adr>> GetAllAdrFilesFromCurrentDirectoryAsync(string targetPath)
Expand Down

0 comments on commit 9c96611

Please sign in to comment.