powershell - Add documentation to custom methods (ScriptMethod) -
a custom powershell script or function can documented standard comment @ origin of body:
function welldocumented { <# .synopsis documented function .description "be verbose in documentation" - .parameter foo should 42 or 15, not more #> param( [int]$foo ) <# ... #> }
get-help welldocumented
returns nice info then. how can document custom scriptmethod
s in custom objects? next not work:
$myclass | add-member -memtype scriptmethod -name "foo" -value { <# .synopsis - brief .description #> <# ... #> }
is there standard way document scriptmethods?
you can write script method separate function first (like did welldocumented
) pass function scriptblock:
$myclass | add-member -memtype scriptmethod -name "foo" -value ${function:welldocumented}
you still can't phone call get-help $myclass.foo
, can phone call get-help welldocumented
.
in testing not able help on method.
powershell powershell-v2.0 powershell-v3.0
No comments:
Post a Comment