Skip to content

Commit 8170966

Browse files
committed
Add feedback for module containing no exported functions
1 parent 8dc5ce8 commit 8170966

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Source/Convert-HelpToHtmlTree.ps1

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,8 @@ function Convert-HelpToHtmlTree
328328

329329
$emptyNamespaces = $modules.Keys | Where { !$modules[$_] }
330330
if ($emptyNamespaces) {
331-
[void](Handle-MissingValue "No modules found for these namespaces: $emptyNamespaces");
332-
write-warning "Note that 'No modules found' typically indicates your"
333-
write-warning "module directories are not within a namespace directory."
331+
[void](Handle-MissingValue ("No modules found for these namespaces: $emptyNamespaces`n"+
332+
" (typically indicates your module directories are not within a namespace directory)"));
334333
}
335334

336335
$title = ""
@@ -470,9 +469,16 @@ function Process-Module($namespace, $moduleName, $parentTitle)
470469

471470
function Generate-FunctionPages($moduleName, $moduleDocPath, $parentTitle, $helpHash)
472471
{
473-
Get-Command -Module $moduleName |
474-
? { $_.CommandType -in $CMDLET_TYPES } |
475-
Filter-ThisModule $moduleName |
472+
$functions = @(
473+
Get-Command -Module $moduleName |
474+
Where { $_.CommandType -in $CMDLET_TYPES } |
475+
Filter-ThisModule $moduleName)
476+
if (!$functions) {
477+
[void](Handle-MissingValue ("No functions found in $moduleName;`n"+
478+
" (typically this means your functions or cmdlets are not exported)"));
479+
return
480+
}
481+
$functions |
476482
% {
477483
$function = $_.Name
478484
Write-Host (" {0}: {1}" -f $_.CommandType, $function)

0 commit comments

Comments
 (0)