Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PowerShell cmdlet help text and examples #2732

Merged
merged 4 commits into from
Dec 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<#
.SYNOPSIS
Example for 'Get-WinGetSource', 'Add-WinGetSource', 'Remove-WinGetSource', and 'Reset-WinGetSource' cmdlet.
Cmdlets to allow you to manage sources for the Windows Package Manager.
#>

# TODO: Replace parameter with actual module name from PSGallery once module is released.
Param (
[Parameter(Mandatory)]
$ModulePath
)

Import-Module -Name $ModulePath

# List current sources.
Get-WinGetSource

# Add REST source
Add-WinGetSource -Name 'Contoso' -Argument 'https://www.contoso.com/cache' -Type 'Microsoft.Rest'

# Remove source by name
Remove-WinGetSource -Name 'Contoso'

# Reset to default sources
Reset-WinGetSource
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<#
.SYNOPSIS
Example for 'Enable-WinGetSetting' and 'Disable-WinGetSetting' cmdlets.
Cmdlet for enabling/disabling a specified WinGet setting. May require elevation.
#>

# TODO: Replace parameter with actual module name from PSGallery once module is released.
Param (
[Parameter(Mandatory)]
$ModulePath
)

Import-Module -Name $ModulePath

# Enables the 'LocalManifestFiles' setting.
Enable-WinGetSetting -Name LocalManifestFiles

# Disables the 'LocalManifestFiles' setting.
Disable-WinGetSetting -Name LocalManifestFiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<#
.SYNOPSIS
Example for 'Find-WinGetPackage' cmdlet.
Displays all applications available for instasllation.
#>

# TODO: Replace parameter with actual module name from PSGallery once module is released.
Param (
[Parameter(Mandatory)]
$ModulePath
)

Import-Module -Name $ModulePath

# Find all available packages
Find-WinGetPackage

# Find package by name
Find-WinGetPackage -Name git

# Find 10 packages by name
Find-WinGetPackage -Name git -Count 10

# Find package by package identifier
Find-WinGetPackage -Id git.git

# Find exact package from a specific source.
Find-WinGetPackage -Id Git.Git -Source winget -Exact
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<#
.SYNOPSIS
Example for 'Get-WinGetPackage' cmdlet.
Displays a list of the applications currently installed on your computer.
#>

# TODO: Replace parameter with actual module name from PSGallery once module is released.
Param (
[Parameter(Mandatory)]
$ModulePath
)

Import-Module -Name $ModulePath

# List all installed packages
Get-WinGetPackage

# List installed package by name
Get-WinGetPackage -Name git

# List 10 packages by name
Get-WinGetPackage -Name git -Count 10

# List package by package identifier
Get-WinGetPackage -Id git.git

# List exact package from a specific source.
Get-WinGetPackage -Id Git.Git -Source winget -Exact
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<#
.SYNOPSIS
Example for 'Get-WinGetVersion' cmdlet.
Prints the current client version.
#>

# TODO: Replace parameter with actual module name from PSGallery once module is released.
Param (
[Parameter(Mandatory)]
$ModulePath
)

Import-Module -Name $ModulePath

$version = Get-WinGetVersion

Write-Host($version);
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<#
.SYNOPSIS
Example for 'Install-WinGetPackage' cmdlet.
Installs the specified application based on the provided arguments.
#>

# TODO: Replace parameter with actual module name from PSGallery once module is released.
Param (
[Parameter(Mandatory)]
$ModulePath
)

Import-Module -Name $ModulePath

# Install a package by name
Install-WinGetPackage -Name powertoys

# Install a package by version and package identifier.
Install-WinGetPackage -Id Microsoft.PowerToys -Version 0.15.2

# Install a package from a specific source
Install-WinGetPackage -Id Microsoft.PowerToys -Source winget

# Install a package with a specific architecture and scope.
Install-WinGetPackage -Id Microsoft.PowerToys -Architecture X64 -Scope User
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<#
.SYNOPSIS
Example for 'Uninstall-WinGetPackage' cmdlet.
Uninstalls the specified application.
#>

# TODO: Replace parameter with actual module name from PSGallery once module is released.
Param (
[Parameter(Mandatory)]
$ModulePath
)

Import-Module -Name $ModulePath

# Uninstall a package by name
Uninstall-WinGetPackage -Name powertoys

# Uninstall a package by version and package identifier.
Uninstall-WinGetPackage -Id Microsoft.PowerToys -Version 0.15.2

# Uninstall a package from a specific source
Uninstall-WinGetPackage -Id Microsoft.PowerToys -Source winget
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<#
.SYNOPSIS
Example for 'Update-WinGetPackage' cmdlet.
Updates the specified application.
#>

# TODO: Replace parameter with actual module name from PSGallery once module is released.
Param (
[Parameter(Mandatory)]
$ModulePath
)

Import-Module -Name $ModulePath

# Update a package by name
Update-WinGetPackage -Name powertoys

# Update a package by version and package identifier.
Update-WinGetPackage -Id Microsoft.PowerToys -Version 0.15.2

# Update a package with silent mode
Update-WinGetPackage -Id Microsoft.PowerToys -Mode Silent

# Force update a package
Update-WinGetPackage -Id Microsoft.PowerToys -Force
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ else {
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @(
'Get-WinGetVersion'
'Get-WinGetVersion',
'Enable-WinGetSetting',
'Disable-WinGetSetting',
'Add-WinGetSource',
Expand Down Expand Up @@ -120,7 +119,8 @@ PrivateData = @{
'PSEdition_Desktop',
'PSEdition_Core',
'Windows',
'WindowsPackageManager'
'WindowsPackageManager',
'WinGet'
)

# A URL to the license for this module.
Expand Down
Loading