Fix Get-Help for advanced functions with MAML help content (#8353)

This commit is contained in:
Aditya Patwardhan
2018-11-30 09:49:32 -08:00
committed by GitHub
parent e721f7bbc3
commit 13e2559392
9 changed files with 20 additions and 36 deletions
@@ -313,13 +313,20 @@ namespace System.Management.Automation
// and the nested module that implements the command
GetModulePaths(commandInfo, out moduleName, out moduleDir, out nestedModulePath);
Collection<String> searchPaths = new Collection<String>(){ HelpUtils.GetUserHomeHelpSearchPath() };
var userHomeHelpPath = HelpUtils.GetUserHomeHelpSearchPath();
Collection<string> searchPaths = new Collection<string>() { userHomeHelpPath };
if (!String.IsNullOrEmpty(moduleDir))
{
searchPaths.Add(moduleDir);
}
if (!String.IsNullOrEmpty(userHomeHelpPath) && !String.IsNullOrEmpty(moduleName))
{
searchPaths.Add(Path.Combine(userHomeHelpPath, moduleName));
}
if (!String.IsNullOrEmpty(moduleName) && !String.IsNullOrEmpty(moduleDir))
{
// Search for <ModuleName>-Help.xml under ModuleBase folder
@@ -385,7 +385,7 @@ Describe 'help can be found for CurrentUser Scope' -Tags 'CI' {
Remove-Item $userHelpRoot -Force -ErrorAction SilentlyContinue -Recurse
UpdateHelpFromLocalContentPath -ModuleName 'Microsoft.PowerShell.Core' -Scope 'CurrentUser'
UpdateHelpFromLocalContentPath -ModuleName 'Microsoft.PowerShell.Management' -Scope 'CurrentUser'
UpdateHelpFromLocalContentPath -ModuleName 'PSReadLine' -Scope CurrentUser -Force
UpdateHelpFromLocalContentPath -ModuleName 'Microsoft.PowerShell.Archive' -Scope 'CurrentUser' -Force
UpdateHelpFromLocalContentPath -ModuleName 'PackageManagement' -Scope CurrentUser -Force
## Delete help from global scope if it exists.
@@ -401,15 +401,15 @@ Describe 'help can be found for CurrentUser Scope' -Tags 'CI' {
Remove-Item $coreHelpFilePath -Force -ErrorAction SilentlyContinue
}
$psreadlineHelpFilePath = Join-Path (Get-Module PSReadLine -ListAvailable).ModuleBase -ChildPath $currentCulture -AdditionalChildPath 'Microsoft.PowerShell.PSReadLine.dll-Help.xml'
if (Test-Path $psreadlineHelpFilePath) {
Remove-Item $psreadlineHelpFilePath -Force -ErrorAction SilentlyContinue
$archiveHelpFilePath = Join-Path (Get-Module Microsoft.PowerShell.Archive -ListAvailable).ModuleBase -ChildPath $currentCulture -AdditionalChildPath 'Microsoft.PowerShell.Archive-help.xml'
if (Test-Path $archiveHelpFilePath) {
Remove-Item $archiveHelpFilePath -Force -ErrorAction SilentlyContinue
}
$TestCases = @(
@{TestName = 'module under $PSHOME'; CmdletName = 'Add-Content'}
@{TestName = 'module is a PSSnapin'; CmdletName = 'Get-Command' }
@{TestName = 'module is under $PSHOME\Modules'; CmdletName = 'Get-PSReadlineOption' }
@{TestName = 'module is under $PSHOME\Modules'; CmdletName = 'Compress-Archive' }
@{TestName = 'module has a version folder'; CmdletName = 'Find-Package' }
)
}
@@ -442,20 +442,20 @@ Describe 'help can be found for AllUsers Scope' -Tags @('Feature', 'RequireAdmin
Remove-Item $coreHelpFilePath -Force -ErrorAction SilentlyContinue
}
$psreadlineHelpFilePath = Join-Path (Get-Module PSReadLine -ListAvailable).ModuleBase -ChildPath $currentCulture -AdditionalChildPath 'Microsoft.PowerShell.PSReadLine.dll-Help.xml'
if (Test-Path $psreadlineHelpFilePath) {
Remove-Item $psreadlineHelpFilePath -Force -ErrorAction SilentlyContinue
$archiveHelpFilePath = Join-Path (Get-Module Microsoft.PowerShell.Archive -ListAvailable).ModuleBase -ChildPath $currentCulture -AdditionalChildPath 'Microsoft.PowerShell.Archive-help.xml'
if (Test-Path $archiveHelpFilePath) {
Remove-Item $archiveHelpFilePath -Force -ErrorAction SilentlyContinue
}
UpdateHelpFromLocalContentPath -ModuleName 'Microsoft.PowerShell.Core' -Scope 'AllUsers'
UpdateHelpFromLocalContentPath -ModuleName 'Microsoft.PowerShell.Management' -Scope 'AllUsers'
UpdateHelpFromLocalContentPath -ModuleName 'PSReadLine' -Scope 'AllUsers' -Force
UpdateHelpFromLocalContentPath -ModuleName 'Microsoft.PowerShell.Archive' -Scope 'AllUsers' -Force
UpdateHelpFromLocalContentPath -ModuleName 'PackageManagement' -Scope 'AllUsers' -Force
$TestCases = @(
@{TestName = 'module under $PSHOME'; CmdletName = 'Add-Content'}
@{TestName = 'module is a PSSnapin'; CmdletName = 'Get-Command' }
@{TestName = 'module is under $PSHOME\Modules'; CmdletName = 'Get-PSReadlineOption' }
@{TestName = 'module is under $PSHOME\Modules'; CmdletName = 'Compress-Archive' }
@{TestName = 'module has a version folder'; CmdletName = 'Find-Package' }
)
}
@@ -20,7 +20,6 @@ $powershellCoreModules = @(
"Microsoft.WsMan.Management"
"PackageManagement"
# "PowershellGet"
"PSReadline"
)
# The file extension for the help content on the Download Center.
@@ -53,16 +52,12 @@ $testCases = @{
HelpInstallationPathHome = "$userHelpRoot\CimCmdlets\en-US"
}
<#
This scenario is broken due to issue # https://github.com/PowerShell/platyPS/issues/241
Re-enable when issue is fixed.
"Microsoft.PowerShell.Archive" = @{
HelpFiles = "Microsoft.PowerShell.Archive.psm1-help.xml"
HelpFiles = "Microsoft.PowerShell.Archive-help.xml"
HelpInfoFiles = "Microsoft.PowerShell.Archive_eb74e8da-9ae2-482a-a648-e96550fb8733_HelpInfo.xml"
CompressedFiles = "Microsoft.PowerShell.Archive_eb74e8da-9ae2-482a-a648-e96550fb8733_en-US_HelpContent$extension"
HelpInstallationPath = "$pshome\Modules\Microsoft.PowerShell.Archive\en-US"
}
#>
"Microsoft.PowerShell.Core" = @{
HelpFiles = "System.Management.Automation.dll-help.xml"
@@ -143,14 +138,6 @@ $testCases = @{
HelpInstallationPath = "$pshome\Modules\PowershellGet\en-US"
HelpInstallationPathHome = "$userHelpRoot\PackageManagement\en-US"
}
"PSReadline" = @{
HelpFiles = "Microsoft.PowerShell.PSReadLine.dll-help.xml"
HelpInfoFiles = "PSReadline_5714753b-2afd-4492-a5fd-01d9e2cff8b5_HelpInfo.xml"
CompressedFiles = "PSReadline_5714753b-2afd-4492-a5fd-01d9e2cff8b5_en-US_helpcontent$extension"
HelpInstallationPath = "$pshome\Modules\PSReadLine\en-US"
HelpInstallationPathHome = "$userHelpRoot\PSReadLine\en-US"
}
}
# These are the inbox modules.
@@ -4,7 +4,7 @@
<SupportedUICultures>
<UICulture>
<UICultureName>en-US</UICultureName>
<UICultureVersion>5.0.2.0</UICultureVersion>
<UICultureVersion>6.1.0.1</UICultureVersion>
</UICulture>
</SupportedUICultures>
</HelpInfo>
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<HelpInfo xmlns="http://schemas.microsoft.com/powershell/help/2010/05">
<HelpContentURI>https://go.microsoft.com/fwlink/?linkid=855966</HelpContentURI>
<SupportedUICultures>
<UICulture>
<UICultureName>en-US</UICultureName>
<UICultureVersion>5.0.4.0</UICultureVersion>
</UICulture>
</SupportedUICultures>
</HelpInfo>