PowerShell / PowerShell/PSResourceGet

Install-Module needs better parity with Get-Module

Open
#50 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Install Needs-Attention :wave: Resolved-3.0
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the parameter definitions and binding behavior of Install-Module with Get-Module and Import-Module, focusing on FullyQualifiedName, FullyQualifiedModule, ModuleSpecification, Name, and ModuleName. Done means Install-Module accepts the same module specification object, or supports the proposed hashtable splatting workflow, with behavior consistent with the related commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.