Get-AstLineComment¶
SYNOPSIS¶
Extracts comment tokens from a given line of PowerShell code.
SYNTAX¶
__AllParameterSets¶
Get-AstLineComment [-Line] <string> [[-Kind] <string>] [<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
This function parses a given line of PowerShell code and extracts comment tokens. It utilizes the PowerShell parser to analyze the input and return tokens that match the specified kind, defaulting to 'Comment'.
EXAMPLES¶
EXAMPLE 1¶
"# This is a comment" | Get-AstLineComment
Output:
Kind : Comment
Text : # This is a comment
Extracts the comment token from the input PowerShell line.
PARAMETERS¶
-Kind¶
The type of comment to extract.
Type: System.String
DefaultValue: Comment
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Line¶
Input line of PowerShell code from which to extract the comment.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
System.String¶
{{ Fill in the Description }}
OUTPUTS¶
System.Management.Automation.Language.Token¶
{{ Fill in the Description }}
NOTES¶
An array of tokens representing comments extracted from the input line.