Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for dynamically naming output files #120

Closed
BernieWhite opened this issue Jan 13, 2021 · 0 comments · Fixed by #142
Closed

Add support for dynamically naming output files #120

BernieWhite opened this issue Jan 13, 2021 · 0 comments · Fixed by #142
Labels
enhancement A request to change or add to current behaviour

Comments

@BernieWhite
Copy link
Member

Currently there is no real ability to dynamically change the name of the generated output file based on content within PSDocs. It needs to be decided before Invoke-PSDocument is called and passed as a parameter.

In the absence of -InstanceName the output file uses the name of the document definition.

This approach is inflexible at large scale because it generally requires a PowerShell wrapper block to be used.

For example:

# Scan for Azure template file recursively in the templates/ directory
Get-AzDocTemplateFile -Path templates/ | ForEach-Object {
    # Generate a standard name of the markdown file. i.e. <name>_<version>.md
    $template = Get-Item -Path $_.TemplateFile;
    $templateName = $template.Directory.Parent.Name;
    $version = $template.Directory.Name;
    $docName = "$($templateName)_$version";

    # Generate markdown
    Invoke-PSDocument -Module PSDocs.Azure -OutputPath out/docs/ -InputObject $template.FullName -InstanceName $docName;
}
@BernieWhite BernieWhite added the enhancement A request to change or add to current behaviour label Jan 13, 2021
BernieWhite added a commit that referenced this issue Feb 12, 2021
This was referenced Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A request to change or add to current behaviour
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant