PowerShell / PowerShell/PSResourceGet

Make Update-module behave more like nuget update/choco update

Abierto
#77 2 comentarios 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
C#
Estrellas
576
Forks
114
Merge medio
1 d 2 h
PR fusionados (30 d)
7

Descripción

Expected Behavior

Example from related tool

in chocolatey and I believe nuget as well you can install a package that isn't already installed or update one that is with choco update packagename or nuget update packagename this makes it so one command can be universal for installing or upgrading a package making dependency handling and general install/maintenance an easier one line task.

Application

If Update-Module would call install-module if it finds the module in a trusted repository when it isn't already installed, it could make for a much smoother experience.

Additional automation for reloading

Update-Module should also have the ability to 'reload' the module that was updated.
So as soon as the update or new install is done it removes the module from the session if it already exists and then imports the new version unless it was otherwise specified to not import

Current Behavior

Installations

If you try to run update-module on a module that isn't installed it just says that one isn't installed

Reloading

Currently to get the new version of a module in your powershell session properly you need to

  1. update the module
  2. remove the module
    3 import the module
    If you try to just import the module after updating, it will import both version side by side.
    While I realize there are times when side by side module versions may be needed, other times this creates collisions and confusion as to which version of any given function will end up being used.

Possible Solution

For adding installing, I imagine a try/catch block for catching when modules aren't already installed and trying to install would do the trick for most cases.

perhaps reloading could be implemented via switch parameter to turn this off if it became default behavior or on to do this on demand
i.e there be a -Import or -reload or alternatively and preferably a -noreload or -noimport switch.
There could also just be a separate function for this functionality such as sync-module or some other verb that isn't there yet.

Context

It becomes a bit tedious to have to run 3 different commands to get an updated module into a session or script. As well keeping modules up to date and getting new ones installed gets difficult. With chocolatey packages I only ever use the cup command because it is so much simpler to install and update with one command.

Your Environment


$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17134.228
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.228
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

No se nombran archivos fuente ni pruebas. Empieza revisando los puntos de entrada Update-Module, Install-Module, Remove-Module e Import-Module y su comportamiento actual; define los casos esperados de instalación, actualización y recarga antes de determinar el alcance necesario.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
powershell
Área
cli, tooling
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.