Skip to content

Commit ee553c9

Browse files
author
James Brundage
committed
Get-MarkdownHelp - Improving Alias Behavior (Fixes #130)
1 parent 4b27a9c commit ee553c9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Get-MarkdownHelp.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,19 @@
9797
# We decorate that object with the typename `PowerShell.Markdown.Help`.
9898
$helpObj.pstypenames.clear()
9999
$helpObj.pstypenames.add('PowerShell.Markdown.Help')
100+
$IsHelpAboutAlias = $helpObj.Name -ne $gotHelp.Name
101+
$helpObj | Add-Member NoteProperty IsAlias $IsHelpAboutAlias -Force
102+
if ($IsHelpAboutAlias) {
103+
$aliasCommand = $ExecutionContext.SessionState.InvokeCommand.GetCommand($gotHelp.Name, 'Alias')
104+
$helpObj | Add-Member NoteProperty AliasCommand $aliasCommand -Force
105+
}
100106

101107
# Then we attach parameters passed to this command to the help object.
102108
# * `-Rename` will become `[string] .Rename`
103109
if ($Rename) {
104110
$helpObj | Add-Member NoteProperty Rename $Rename -Force
111+
} elseif ($IsHelpAboutAlias) {
112+
$helpObj | Add-Member NoteProperty Rename $gotHelp.Name -Force
105113
}
106114

107115
# * `-SectionOrder` will become `[string[]] .SectionOrder`

0 commit comments

Comments
 (0)