Skip to content

Commit

Permalink
Update help. Remove GridView parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamErde committed Oct 29, 2024
1 parent 53822a6 commit a0b3744
Showing 1 changed file with 10 additions and 28 deletions.
38 changes: 10 additions & 28 deletions src/PSPreworkout/Public/Get-TypeAccelerator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ function Get-TypeAccelerator {
.PARAMETER Name
The name of a specific type accelerator to get.
.PARAMETER GridView
Show the output in a grid view.
.EXAMPLE
Get-TypeAccelerator -Name ADSI
.EXAMPLE
Get-TypeAccelerator -Name ps*
Get all type accelerators that begin with the string "ps".
.NOTES
Author: Sam Erde
Version: 0.0.2
Modified: 2024/10/12
Version: 0.0.3
Modified: 2024/10/29
Thanks to Jeff Hicks (@JDHITSolutions) for helpful suggestions and improvements on this output!
Change Log: Removed the grid view option to allow user flexibility in how they want to output the results.
#>
[CmdletBinding(HelpUri = 'https://day3bits.com/PSPreworkout/Get-TypeAccelerator')]
[OutputType('System.Array')]
Expand All @@ -32,12 +36,7 @@ function Get-TypeAccelerator {
[Parameter(Position = 0, HelpMessage = 'The name of the type accelerator, such as "ADSI."')]
[SupportsWildcards()]
[string]
$Name = '*',

# Show a grid view of the loaded assemblies
[Parameter()]
[switch]
$GridView
$Name = '*'
)

$TypeAccelerators = ([PSObject].Assembly.GetType('System.Management.Automation.TypeAccelerators')::Get).GetEnumerator() |
Expand All @@ -51,22 +50,5 @@ function Get-TypeAccelerator {
Type = $_.Value.FullName
}
}

if ($PSBoundParameters.ContainsKey('GridView')) {

if ((Get-Command -Name Out-ConsoleGridView -ErrorAction SilentlyContinue) -and ($PSVersionTable.PSEdition -eq 'Core')) {

$TypeAccelerators | Out-ConsoleGridView -OutputMode Multiple

} elseif ((Get-Command -Name Out-GridView -ErrorAction SilentlyContinue) -and ($PSVersionTable.PSEdition -eq 'Desktop')) {

$TypeAccelerators | Out-GridView -OutputMode Multiple

} else {
Write-Output 'The Out-GridView and Out-ConsoleGridView cmdlets were not found. Please install the Microsoft.PowerShell.ConsoleGuiTools module or re-install the PowerShell ISE if using Windows PowerShell 5.1.'
$TypeAccelerators | Format-Table -AutoSize
}
}

$TypeAccelerators
}

0 comments on commit a0b3744

Please sign in to comment.