Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public bool Execute()
.Render(model)
.Save(
m_Configuration.OutputPath,
cleanOutputDirectory: true,
cleanOutputDirectory: m_Configuration.ShouldDeleteOutputPathBeforeGeneration,
markdownOptions: m_Configuration.Template.Default.GetSerializationOptions(m_Logger)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ public enum TemplateName

public class DefaultTemplateConfiguration : IConfigurationWithMarkdownPresetSetting
{
public const string s_DefaultApplicationMdFileName = "index.md";

public bool IncludeVersion { get; set; }

public bool IncludeAutoGeneratedNotice { get; set; }

public MarkdownPreset MarkdownPreset { get; set; } = MarkdownPreset.Default;

public string ApplicationMdFileName { get; set; } = s_DefaultApplicationMdFileName;

}

public class TemplateConfiguration
Expand All @@ -33,6 +37,8 @@ public class TemplateConfiguration
[ConvertToFullPath]
public string AssemblyPath { get; set; } = "";

public bool ShouldDeleteOutputPathBeforeGeneration { get; set; } = true;

public TemplateConfiguration Template { get; set; } = new TemplateConfiguration();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static ITemplate<ApplicationDocumentation> GetTemplate(ILogger logger, Co
switch (configuration.Template.Name)
{
case CommandLineHelpConfiguration.TemplateName.Default:
return new CommandLineHelpDefaultTemplate(configuration, new DefaultCommandLineHelpPathProvider(), logger);
return new CommandLineHelpDefaultTemplate(configuration, new DefaultCommandLineHelpPathProvider(configuration.Template.Default.ApplicationMdFileName), logger);

default:
throw new InvalidTemplateConfigurationException($"Unknown template '{configuration.Template.Name}'");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
using Grynwald.MdDocs.CommandLineHelp.Model;
using Grynwald.MdDocs.CommandLineHelp.Configuration;
using Grynwald.MdDocs.CommandLineHelp.Model;

namespace Grynwald.MdDocs.CommandLineHelp.Templates.Default
{
public class DefaultCommandLineHelpPathProvider : ICommandLineHelpPathProvider
{
public string GetPath(ApplicationDocumentation model) => "index.md";
private readonly string m_ApplicationDocumentationName;

public DefaultCommandLineHelpPathProvider(string applicationDocumentationName = CommandLineHelpConfiguration.DefaultTemplateConfiguration.s_DefaultApplicationMdFileName)
{
m_ApplicationDocumentationName = applicationDocumentationName;
}

public string GetPath(ApplicationDocumentation model) => m_ApplicationDocumentationName;

public string GetPath(CommandDocumentation model) => $"commands/{model.Name}.md";
}
Expand Down