Skip to content

Commit

Permalink
Add support for getting HelpCommandData from script files
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Hunt committed Feb 1, 2024
1 parent def2a68 commit e13acff
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/public/Get-HelpCommandData.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
function Get-HelpCommandData {
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName = 'byName')]
param (
[Parameter(Mandatory,
Position = 0,
ValueFromPipeline,
ValueFromPipelineByPropertyName)]
ValueFromPipelineByPropertyName, ParameterSetName = 'byName')]
[String]
$Name
$Name,

[Parameter(Mandatory,
Position = 0,
ValueFromPipeline,
ParameterSetName = 'byObject')]
[PSCustomObject]
$HelpSource
)

begin {
Expand Down Expand Up @@ -53,7 +60,9 @@ function Get-HelpCommandData {

process {

$helpSource = Get-Help -Name $Name -Category Function
if ($PSBoundParameters.ContainsKey('Name')) {
$helpSource = Get-Help -Name $Name -Category Function
}

$commandData = [PSCustomObject]@{
PSTypeName = 'HelpCommandData'
Expand Down

0 comments on commit e13acff

Please sign in to comment.