Edit

Share via


Export-YamlCommandHelp

Exports CommandHelp objects to YAML files.

Syntax

__AllParameterSets

Export-YamlCommandHelp
    [-CommandHelp] <CommandHelp[]>
    [-Encoding <Encoding>]
    [-Force]
    [-OutputFolder <string>]
    [-Metadata <hashtable>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This command exports a CommandHelp object to a Yaml file. You can add metadata frontmatter to the Yaml file by using the Metadata parameter. You can get a CommandHelp object by using the Export-YamlCommandHelp cmdlet or one of the Import-* cmdlets.

Examples

Example 1 - Convert Markdown command help content to Yaml format

This example imports Markdown help in the old format from the .\v1 folder and exports it to the .\v2 folder in the new format.

$mdfiles = Measure-PlatyPSMarkdown -Path .\v2\Microsoft.PowerShell.PlatyPS\*.md
$mdfiles | Where-Object Filetype -match 'CommandHelp' |
    Import-MarkdownCommandHelp -Path {$_.FilePath} |
    Export-YamlCommandHelp -OutputFolder .\v2\yaml
    Directory: D:\Git\PS-Src\platyPS\v2docs\v2\yaml

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           8/26/2024  3:56 PM           3535 Compare-CommandHelp.yml
-a---           8/26/2024  3:56 PM           4776 Export-MamlCommandHelp.yml
-a---           8/26/2024  3:56 PM           8150 Export-MarkdownCommandHelp.yml
-a---           8/26/2024  3:56 PM           4998 Export-MarkdownModuleFile.yml
-a---           8/26/2024  3:56 PM           6357 Export-YamlCommandHelp.yml
-a---           8/26/2024  3:56 PM           5396 Export-YamlModuleFile.yml
-a---           8/26/2024  3:56 PM           3019 Import-MamlHelp.yml
-a---           8/26/2024  3:56 PM           4235 Import-MarkdownCommandHelp.yml
-a---           8/26/2024  3:56 PM           4318 Import-MarkdownModuleFile.yml
-a---           8/26/2024  3:56 PM           4391 Import-YamlCommandHelp.yml
-a---           8/26/2024  3:56 PM           3862 Import-YamlModuleFile.yml
-a---           8/26/2024  3:56 PM           2325 Measure-PlatyPSMarkdown.yml
-a---           8/26/2024  3:56 PM           5190 New-CommandHelp.yml
-a---           8/26/2024  3:56 PM           8335 New-MarkdownCommandHelp.yml
-a---           8/26/2024  3:56 PM           4697 New-MarkdownModuleFile.yml
-a---           8/26/2024  3:56 PM           3468 Test-MarkdownCommandHelp.yml
-a---           8/26/2024  3:56 PM           3172 Update-CommandHelp.yml
-a---           8/26/2024  3:56 PM           3908 Update-MarkdownCommandHelp.yml
-a---           8/26/2024  3:56 PM           5217 Update-MarkdownModuleFile.yml

Parameters

-CommandHelp

The CommandHelp object to export. You can pass the CommandHelp object on the pipeline or by using the Command parameter.

Parameter properties

Type:

Microsoft.PowerShell.PlatyPS.Model.CommandHelp[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Encoding

The encoding to use when writing the markdown file. If no value is specified, encoding defaults to the value of the $OutputEncoding preference variable.

Parameter properties

Type:Encoding
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Use the Force parameter to overwrite the output file if it already exists.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Metadata

The metadata to add to the frontmatter of the markdown file. The metadata is a hashtable where the you specify the key and value pairs to add to the frontmatter. New key names are added to the existing frontmatter. The values of existing keys are overwritten.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OutputFolder

The folder where the markdown file is saved. If the folder doesn't exist, it's created.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Runs the command in a mode that only reports what would happen without performing the actions.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

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

Microsoft.PowerShell.PlatyPS.Model.CommandHelp

Outputs

FileInfo