Skip to content

Get-PlasterTemplate -IncludeInstalledModules return templates from all installed module versions #348

@Glober777

Description

@Glober777

I've noticed that if I have several version of the same module containing a plaster template inside (even if the manifest has the same version), Get-PlasterTemplate cmdlet returns all instances of the templates from all the versions of the same module. So if I have the following:

  • MyTemplatesPSModule v 1.0.0.0
    • MyTemplate v1.0.0.0
  • MyTemplatesPSModule v1.0.0.1
    • MyTemplate v1.0.0.0
  • MyTemplatesPSModule v1.0.0.2
    • MyTemplate v1.0.0.1

Running Get-PlasterTemplate -IncludeInstalledModules currently returns all three templates (besides the default ones). This behavior makes me want to make sure that I uninstall previous versions of such modules right after Update-Module. Is there really a need to go through all the PS Module versions instead of just the latest ones? To me it seems that going through the latest ones only should be the default behavior (similar to Import-Module) besides, it should run faster. If there's actually a need to expand all previous module versions, the functionality could still be accessible through a dedicated switch (i.e. -ExpandAllModuleVersions). There might as well also be an additional switch (i.e. -IncludeAllTemplates) to list out all template instances even if their versions are identical, as follows:

Get-PlasterTemplate -IncludeInstalledModules
# Should return: 
# Default Templates 
# MyTemplate v1.0.0.1

Get-PlasterTemplate -IncludeInstalledModules -ExpandAllModuleVersions
# Should return: 
# Default Templates 
# MyTemplate v1.0.0.0 (from MyTemplatesPSModule v1.0.0.1)
# MyTemplate v1.0.0.1

Get-PlasterTemplate -IncludeInstalledModules -ExpandAllModuleVersions -IncludeAllTemplates
# Should return: 
# Default Templates
# MyTemplate v1.0.0.0 (from MyTemplatesPSModule v1.0.0.0)
# MyTemplate v1.0.0.0 (from MyTemplatesPSModule v1.0.0.1)
# MyTemplate v1.0.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions