What is required for Powershell 2.0 to display the default script parameter value on the help page?

I have the following simple script that takes text as input and writes it to the host.

<#
.SYNOPSIS
    Writes the input string to the host.
.PARAMETER Text
    The text to write to the host.
#>

param([string]$text = "hello world!")
Write-Host $text

To help for this script, I run the following command in a Powershell session, where write-text.ps1is the name of this script.

get-help .\write-text.ps1 -full

In the next release, I expect to see the default value of the script parameter specified in the help, but I do not:

PARAMETERS
    -text <String>
        The text to write to the host.

        Required?                    false
        Position?                    1
        Default value
        Accept pipeline input?       false
        Accept wildcard characters?

What do I need to add or change in this script for the help module to display the default value?

+5
source share
2 answers

, . MAML.

+5

Script , , , , . , ...

, , :

<#
.SYNOPSIS
MumbleMumble

.DESCRIPTION
Even more MumbleMumble

.EXAMPLE
PS> MumbleMumble
#>

function MumbleMumble
{
   param
   (
      #The in-parameter for MumbleMumble, as text
      $text
   )

   ...
}

, - , :).

+3

All Articles