![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | formatting command syntax like get-help or get-command i'm trying to work out how to format the maml help objects like get-help or get-command does, in the example same format.. here is my code so far, however in all cases it doesn't behave exactly the same, in some cases it doesn't put enough brackets around, and in cases when there is a parameter without a value, it puts double brackets. i've looked in the help.format.ps1xml to try to work out hte same logic but still got a few things wrong. so i figured i'd put it out here for the community and MS people to look at.. the benefit is when its done i'll release and blog my whole mamlhelp -> richHTML code, that i'll be incorporating into powershell analyzer.. #region syntax $help = get-Help get-Command -full ($help.syntax) | % { $_.syntaxitem } | % { $str = "";$("$($_.name) " $_ | % { $_.parameter | % { $myp = $_;$_.psobject | % { if ($_.properties["required"].value -ne "true") { "[" } if (($_.properties["position"].value -ne $()) -and ($_.properties["position"].value -ne "") ) { "[" } "-";$_.properties["name"].value if (($_.properties["position"].value -ne $()) -and ($_.properties["position"].value -ne "")) { "]" } if ($_.properties["parametervalue"] -ne $() ) { '<' + $_.properties["parametervalue"].value + '>' } if ($_.properties["parametervaluegroup"] -ne $() ) { "{" $_.properties["parametervaluegroup"].value | % { $i=0; $out=""; foreach($a in $_.parametervalue) { if($i -gt 0) { $out = $out + " | "; } $out = $out + "<" + $a + ">"; $i = $i + 1; } $out; } "}" } if ($_.properties["required"].value -ne "true") { "] " } } } } ) | % { $str = $str + $_ } ; $str } #endregion |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Command Line Ren (Rename) command broken? | SixSigmaGuy | Vista General | 5 | 05-20-2008 05:52 AM |
| Command line option syntax error. Type /? for Help | Antojak | Vista mail | 0 | 01-28-2008 03:28 AM |
| "invalid STORE command syntax invalid message set syntax" | Catullus Nacakus | Vista mail | 6 | 01-26-2008 05:46 PM |
| Formatting Inline for Export-CliXML Command | Brandon Shell | PowerShell | 14 | 09-18-2007 10:56 PM |
| Powershell.exe command-line syntax | EnigmaticSoul | PowerShell | 4 | 03-29-2007 08:40 PM |