Sha256: 8e74dea9226e3240e941012a6d9d8dacabe7bf8d23cae74f2677d2193030bec1

Contents?: true

Size: 1.29 KB

Versions: 13

Compression:

Stored size: 1.29 KB

Contents

function Get-CommandDefinitionHtml {

    # this tells powershell to allow advanced features,
    # like the [validatenotnullorempty()] attribute below.
    [CmdletBinding()]
    param(
        [ValidateNotNullOrEmpty()]
        [string]$name
    )

    $command = get-command $name

    # Look mom! I'm a cmdlet!
    $PSCmdlet.WriteVerbose("Dumping HTML for " + $command)

@"
    <html>
        <head>
            <title>$($command.name)</title>
        </head>
        <body>
            <table border="1">
$(
    $command.parametersets | % {
@"

            <tr>
                <td>$($_.name)</td>
                <td>
                    <table border="1">
                        <tr>
                            <th colspan="8">Parameters</th>

$(
        $count = 0
        $_.parameters | % {
            if (0 -eq ($count % 8)) {
@'
                        </tr>
                        <tr>
'@
            }
@"
                            <td>$($_.name)</td>
"@
            $count++
    }
)
                        </tr>
                    </table>
                </td>
            </tr>
"@
    }
)
            </table>
        </body>
    </html>
"@
}

Get-CommandDefinitionHtml get-item > out.html

# show in browser
invoke-item out.html

Version data entries

13 entries across 13 versions & 5 rubygems

Version Path
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/pygments.rb-0.6.3/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
pygments.rb-0.6.3 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
pygments.rb-0.6.2 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
pygments.rb-0.6.1 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
pygments.rb-0.6.0 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
mortar-pygments.rb-0.5.7 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
mortar-pygments.rb-0.5.6 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
mortar-pygments.rb-0.5.5 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
pygments.rb-jruby-0.5.4.2 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
pygments.rb-jruby-0.5.4.1 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
pygments.rb-jruby-0.5.4 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
gitlab-pygments.rb-0.5.4 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1
pygments.rb-0.5.4 vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1