Re: Unresolved "about" references in PoSh on-line help



Please file a bug.

--
Arul Kumaravel [MSFT]
Development Manager,
Windows PowerShell,
Microsoft Corporation


This posting is provided "AS IS" with no warranties, and confers no rights
"Seva" <Seva@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B6C9289F-AF2B-4A33-BC35-DB141E4C59AD@xxxxxxxxxxxxxxxx
There are still a bunch of unresolved "about" references in the on-line
help.
I know that documentation is still being finalized, but I though may be
simple code snippet will save a bit of time and frustration for someone
who's
trying to follow all the "about" references.

$dangling_refs = @{}
$format = @{ Expression = {$_.Name}; Label = "Unresolved reference"}, @{
Expression = {$_.Value}; Label = "Referenced in"}
$rx = new-object regex("\bhelp[ ]\b(?<about_ref>about_[\w]+)\b",
"Compiled,IgnoreCase")

foreach ($help_file in (get-childitem -path "$env:ProgramFiles\Windows
PowerShell\v1.0\en" -filter "*.help.txt"))
{
foreach($mtch in ($rx.Matches([String](get-content -Path
$help_file.FullName -ReadCount 0))))
{
$candidate = $mtch.groups["about_ref"].value
if ( -not (test-path "$env:ProgramFiles\Windows
PowerShell\v1.0\en\$candidate.help.txt") )
{
if (-not ($dangling_refs[$candidate] -contains $help_file.Name))
{
$dangling_refs[$candidate] = $dangling_refs[$candidate] +
@($help_file.Name)
}
}
}
}

$dangling_refs | ft $format -wrap
"Total count: " + $dangling_refs.Count

On my box with RC1 the list looks like follows:

$dangling_refs = @{}
$format = @{ Expression = {$_.Name}; Label = "Unresolved reference"}, @{
Expression = {$_.Value}; Label = "Referenced in"}
$rx = new-object regex("\bhelp[ ]\b(?<about_ref>about_[\w]+)\b",
"Compiled,IgnoreCase")

foreach ($help_file in (get-childitem -path "$env:ProgramFiles\Windows
PowerShell\v1.0\en" -filter "*.help.txt"))
{
foreach($mtch in ($rx.Matches([String](get-content -Path
$help_file.FullName -ReadCount 0))))
{
$candidate = $mtch.groups["about_ref"].value
if ( -not (test-path "$env:ProgramFiles\Windows
PowerShell\v1.0\en\$candidate.help.txt") )
{
if (-not ($dangling_refs[$candidate] -contains $help_file.Name))
{
$dangling_refs[$candidate] = $dangling_refs[$candidate] +
@($help_file.Name)
}
}
}
}

$dangling_refs | ft $format -wrap
"Total count: " + $dangling_refs.Count

Unresolved reference Referenced in
-------------------- -------------
about_script_file {about_foreach.help.txt,
about_Function
.help.txt}
about_error_handling about_system_state.help.txt
about_variable {about_Alias.help.txt,
about_Assignment
_operators.help.txt,
about_Function.hel
p.txt,
about_Quoting_rules.help.txt...}
about_policy_variable about_Shell_variable.help.txt
about_data_type
{about_Assignment_operators.help.txt, a
bout_types.ps1xml.help.txt}
about_profile {about_Function.help.txt,
about_History
.help.txt}
about_do about_break.help.txt
about_wildcards default.help.txt
about_unary_operator about_operator.help.txt
about_operator_precedence about_operator.help.txt
about_special_operator about_operator.help.txt

Total count: 11


.



Relevant Pages