mardi 15 novembre 2016

PowerShell Reflection: Define a MIME type or subtype as a script's output type

It's possible in PowerShell to define an output type on scripts. Consider myScript.ps1:

[OutputType([String])]
param(
    [string]$name
)

The following returns String:

(Get-Command .\myScript.ps1).OutputType.Name

But I would like to specify that a script returns text/json or text/xml. What would be a good way of doing that?

Inventing types for OutputType (e.g. [String.JSON]) does not work.





Aucun commentaire:

Enregistrer un commentaire