PowerShell / PowerShell/PSResourceGet
Make Update-module behave more like nuget update/choco update
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 576
- Fork
- 114
- Merge medio
- 1g 2h
- PR unite (30g)
- 7
Descrizione
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
- update the module
- 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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Non sono specificati file sorgente o test. Inizia esaminando gli entry point Update-Module, Install-Module, Remove-Module e Import-Module e il loro comportamento attuale; definisci i casi previsti di installazione, aggiornamento e ricaricamento prima di determinare l'ambito necessario.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- powershell
- Ambito
- cli, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100