Skip to content

Install-Module needs better parity with Get-Module #50

@Jaykul

Description

@Jaykul

In order to provide a consistent interface to scripters using Get-Module and Import-Module, the Install-Module command should accept similar values as Get-Module.

Since Get-Module can only accept module version requirements using the FullyQualifiedModule parameter (which takes a ModuleSpecification[] or a hash table which can cast to one) it would be handy if Install-Module could accept the same object.

Ideally, Install-Module should have a [ModuleSpecification[]]$FullyQualifiedName parameter.

Failing that, Install-Module needs to add a ModuleName alias to it's Name parameter so that we could splat the hashtables, like this:

param(
   [Alias("Name")][string]$ModuleName,
   [Version]$Version
)
$module = [hashtable]$PSBoundParameter
if (-not (Get-Module -FullyQualifiedName $Module -ListAvailable)) {
    Install-Module @Module  # this doesn't currently work
}
Import-Module -FullyQualifiedName $Module

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions