Powershell GUI fronted (WPF) to run categorized console scripts

⌈⌋ ⎇ branch:  ClickyColoury


Artifact [89af90c764]

Artifact 89af90c764c1a503da3e34553af06453d4fe7693:

  • File dev/create-psd1.ps1 — part of check-in [8d563f935e] at 2017-09-23 08:57:59 on branch trunk — comment on PMD extractor (user: mario size: 1140)

# api: ps
# type: cli
# title: create .psd1
# description: module manifest from script meta header
# version: 0.1
#
# Creates a .psd1 file for a .psm1/.ps1
# Contains an even cruder PMD extraction scheme.

[CmdletBinding()]
Param($fn=(ReadHost ".psm1 filename:"));

$target = $fn -replace "\.\w+$",".psd1"
$base = $fn -replace "^.+[\\\\/]",""

# plugin meta block
$src = (Get-Content $fn | Out-String)
$meta = @{}
$src | Select-String "(?m)^#\s*(\w+):\s*([^\n]+)" -AllMatches |
     % { $_.Matches } | % { ,($_.Groups | % { $_.Value }) } |
     % { $meta[$_[1]] = $_[2] }

# create .psd1 file
$psd = @{
    Path = $target
    RootModule = $base
    ModuleToProcess = $base
    Author = $meta.author
    CompanyName = "-"
    Description = $meta.description
    ModuleVersion = $meta.version
    #ProjectUri = "$meta.url"
    Guid = [guid]::newguid()
    PowerShellVersion = "2.0"
    #FormatsToProcess = "$fn.ps1xml"
    ProcessorArchitecture = 'amd64'
    FunctionsToExport = "*"
    AliasesToExport = "*"
    VariablesToExport = ""
    CmdletsToExport = ""
    PassThru = $true
}
New-ModuleManifest @psd | Out-File $target -Encoding UTF8