I want to include the alias header, as the built in functions do, however, when I do, it breaks my examples, which don’t show up when I do Get-Help Get-Foo -Full with .ALIASES added to the help snippet.
Do you know if there is a workaround for this?
Thanks
.ALIASES isn’t listed in the help file Get-Help about_comment_based_help as a valid keyword.
From testing, this looks like a bug. It appears that any invalid keyword in the help inserts an ALIASES section and remove the examples:
In the ISE add the Cmdlet (advanced function) snippet.
Add .TESTKEYWORD to the help section.
Add Get-Help Verb-Noun -Full to the end of the script.
Run the script.
The ALIASES section of the get-help output is being auto-generated by the help system.
function Start-Test
{ }
Just execute:
Set-Alias stt Start-Test
Get-Help Start-Test -Full # Should show the alias now
In a module file (.psm1) you would define the aliases as shown below:
function Start-Test
{ }
Set-Alias stt Start-Test
Export-ModuleMember -Function Start-Test -Alias stt
I hope that helps.
Daniel, That’s strange because mine doesn’t generate an ALIASES on my functions. Here’s my code:
function Connect-MsolTenant
{...}
New-Alias connect Connect-MsolTenant
This is stored in a PowerShell Profile, not a module. Is the reason because I am using New-Alias perhaps?