Skip to content

Commit

Permalink
🔖 Merge branch 'release/v1.3.0' into main
Browse files Browse the repository at this point in the history
Release v1.3.0
  • Loading branch information
teramako committed Oct 5, 2024
2 parents c1df212 + 522a709 commit d573306
Show file tree
Hide file tree
Showing 214 changed files with 22,169 additions and 504 deletions.
62 changes: 62 additions & 0 deletions docs/Make-CommandList.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<#
.SYNOPSIS
Create Command List files
#>
using namespace System.Management.Automation
using namespace System.Collections.Generic

[CmdletBinding()]
param(
[Parameter()]
[string] $Locale = "en-US"
)

$ErrorActionPreference = 'Stop'

$modulePath = Join-Path -Path $PSScriptRoot -ChildPath .. -AdditionalChildPath out, AWX.psm
$module = Import-Module $modulePath -PassThru -Verbose:$false

function Out-CommandList
{
[CmdletBinding()]
[OutputType([System.IO.FileInfo])]
param(
[Parameter(Mandatory)]
[string] $GroupName
,
[Parameter(Mandatory, ValueFromPipeline)]
[CmdletInfo[]] $Command
)
begin
{
$path = Join-Path -Path $PSScriptRoot -ChildPath $Locale -AdditionalChildPath ("CommandListBy{0}.md" -f $GroupName)
$Commands = [List[CmdletInfo]]::new()
}
process
{
$Commands.AddRange($Command)
}
end
{
$Commands |
Group-Object -Property $GroupName |
ForEach-Object -Begin {
"# Command List By $GroupName", "" | Write-Output
} -Process {
("## {0}" -f $_.Name),
"",
(
$_.Group | ForEach-Object { "- [{0}](./cmdlets/{0}.md)" -f $_.Name }
),
"" | Write-Output
} |
Out-File -FilePath $path -Encoding utf8NoBOM

Write-Verbose ("Created command list: GroupBy = {0} to '{1}'" -f $GroupName, $path)
return Get-Item $path
}
}

$module.ExportedCommands.Values | Out-CommandList -GroupName Noun
$module.ExportedCommands.Values | Out-CommandList -GroupName Verb

15 changes: 13 additions & 2 deletions docs/Make-Doc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.SYNOPSIS
Create Documents with platyPS
#>
[CmdletBinding()]
param(
[string] $Locale = "en-US",
[switch] $New
Expand Down Expand Up @@ -89,6 +90,11 @@ function Update-CommonParameterFromMarkdown {
$updateFile = $true
}
}

if (-not $IsWindows) {
$newContent = $content -replace "`r?`n", "`n"
}

# Save file if content has changed
if ($updateFile) {
$newContent | Out-File -Encoding utf8 -FilePath $p
Expand Down Expand Up @@ -170,7 +176,7 @@ if ($New) {
$NewParams = @{
Module = $moduleName;
OutputFolder = $OutputFolder;
AlphabeticParamsOrder = $false;
AlphabeticParamsOrder = $true;
ExcludeDontShow = $true;
Encoding = $Utf8NoBomEncoding;
}
Expand All @@ -179,7 +185,7 @@ if ($New) {
$UpdateParams = @{
Path = $OutputFolder;
RefreshModulePage = $true;
AlphabeticParamsOrder = $false;
AlphabeticParamsOrder = $true;
ExcludeDontShow = $true;
UpdateInputOutput = $false;
Encoding = $Utf8NoBomEncoding;
Expand All @@ -191,6 +197,11 @@ if ($resultFiles.Count -gt 0) {
Repair-PlatyPSMarkdown -Path $resultFiles
}

$moduleMarkdownFile = Join-Path $OutputFolder "$moduleName.md"
if (-not $IsWindows -and (Test-Path -Path $moduleMarkdownFile -PathType Leaf)) {
$content = (Get-Content -Path $moduleMarkdownFile -Raw).TrimEnd() -replace "`r?`n", "`n"
$content | Out-File -FilePath $moduleMarkdownFile -Encoding utf8NoBOM
}

# $externalHelpDirPath = Join-Path $PSScriptRoot ..\out\$Locale
$externalHelpDirPath = Join-Path $module.ModuleBase $Locale
Expand Down
Loading

0 comments on commit d573306

Please sign in to comment.