Skip to content

Accept default values of the template #303

@Glober777

Description

@Glober777

It would be great to have a switch that would allow skipping prompts for parameters that have default values defined. I'm currently using Plaster as a part of a large workflow to generate necessary files out of template and having such a capability would make it much easier to run the cmdlet unattended and make me worry less about updating the code if the manifest gets updated new properties with defaults.

For example, suppose there's a manifest like this:

<?xml version="1.0" encoding="utf-8"?>
<plasterManifest
  schemaVersion="1.1"
  templateType="Item" xmlns="http://www.microsoft.com/schemas/PowerShell/Plaster/v1">
  <metadata>
    <name>IssueRepro</name>
    <id>8245a80e-f39b-49e8-97cc-9676b6f19294</id>
    <version>1.0.0</version>
    <title>IssueRepro</title>
    <description></description>
    <author></author>
    <tags></tags>
  </metadata>
  <parameters>
  <parameter name='CompanyName' type='text' prompt='Please specify the name for your company' default='MyCompany'/>
  <parameter name='SomethingUnique' type='text' prompt='Please specify some very unique value'/>
  </parameters>
  <content></content>
</plasterManifest>

And here's the usage scenario:

Invoke-Plaster -TemplatePath .\MyTemplate -DestinationPath .\OutputFolder -UseDefaultParameterValues

#Prompt for value for 'SomethingUnique'


Invoke-Plaster -TemplatePath .\MyTemplate -DestinationPath .\OutputFolder -SomethingUnique '123' -UseDefaultParameterValues
# will not show any prompts at all

Is this something that you could add?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions