commit 472adffa5b3e40d41c0c5e55ea8c63d5ab51c176 parent 524c43c647b9ffdcde7fd4efc6a8f51c5b6d4626 Author: Muhammad Danish <mdanishkhdev@gmail.com> Date: Tue, 3 Sep 2024 19:32:21 +0500 Updates to PowerShell help docs (#4781) - [x] I have signed the [Contributor License Agreement](https://cla.opensource.microsoft.com/microsoft/winget-pkgs). - [x] This pull request is related to an issue - Closes https://github.com/microsoft/winget-cli/issues/4773 Each change is broken into a separate commit to help with reviewing. Changes include: - Couple more examples for cmdlets - Linter fixes. Majority of them involve newline after a heading & code-fenced blocks wanting a language tag ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/microsoft/winget-cli/pull/4781) Diffstat:
| M | src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetPackage.md | | | 27 | ++++++++++++++++++++++++++- |
| M | src/PowerShell/Help/Microsoft.WinGet.Client/Update-WinGetPackage.md | | | 8 | ++++++++ |
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetPackage.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetPackage.md @@ -24,7 +24,7 @@ Get-WinGetPackage [-Tag <String>] [-Command <String>] [-Count <UInt32>] [-Id <St This command lists all of the packages installed on your system. The output includes packages installed from WinGet sources and packages installed by other methods. Packages that have package -identifiers starting with `MSIX` or `ARP` were not installed from a WinGet source. +identifiers starting with `MSIX` or `ARP` could not be correlated to a WinGet source. ## EXAMPLES @@ -36,6 +36,31 @@ Get-WinGetPackage This example shows how to list all packages installed on your system. +### Example 2: Get package by Id + +```powershell +Get-WinGetPackage -Id "Microsoft.PowerShell" +``` + +This example shows how to get an installed package by its package identifier. + +### Example 3: Get package(s) by name + +```powershell +Get-WinGetPackage -Name "PowerShell" +``` + +This example shows how to get installed packages that match a name value. The command does a substring comparison of the provided name with +installed package names. + +### Example 4: List all packages with an available update + +```powershell +Get-WinGetPackage | Where-Object IsUpdateAvailable +``` + +This example shows how to list all packages that have an available upgrade from one of the configured sources. + ## PARAMETERS ### -Command diff --git a/src/PowerShell/Help/Microsoft.WinGet.Client/Update-WinGetPackage.md b/src/PowerShell/Help/Microsoft.WinGet.Client/Update-WinGetPackage.md @@ -81,6 +81,14 @@ This example shows how to update a specific version of a package using a query. query search for packages matching `Microsoft.PowerShell`. The results of the search a limited to matches with the version of `7.4.4.0`. +### Example 5: Update all packages + +```powershell +Get-WinGetPackage | Where-Object IsUpdateAvailable | Update-WinGetPackage +``` + +This example shows how to update all packages that have an available upgrade from one of the configured sources. + ## PARAMETERS ### -AllowHashMismatch