Skip to content

Commit

Permalink
Fix wrong export of cmdlet
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Aug 7, 2024
1 parent 28156c4 commit caaf671
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Private/New-PSMFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ function New-PSMFile {
$Cmdlet = ($Configuration.Information.Manifest.CmdletsToExport | Sort-Object -Unique) -join "','"
$Cmdlet = "'$Cmdlet'"
} else {
$Cmdlet = '"*"'
if ($BinaryModule.Count -gt 0) {
$Cmdlet = '"*"'
}
}

# This allows to export functions only if module loading works correctly
Expand Down Expand Up @@ -113,7 +115,7 @@ function New-PSMFile {

# for now we just export everything
# we may need to change it in the future
if ($BinaryModule.Count -gt 0 -or $Cmdlet) {
if ($Cmdlet) {
"Export-ModuleMember -Function @(`$FunctionsToLoad) -Alias @(`$AliasesToLoad) -Cmdlet $Cmdlet" | Out-File -Append -LiteralPath $Path -Encoding $Encoding -ErrorAction Stop
} else {
"Export-ModuleMember -Function @(`$FunctionsToLoad) -Alias @(`$AliasesToLoad)" | Out-File -Append -LiteralPath $Path -Encoding $Encoding -ErrorAction Stop
Expand All @@ -123,7 +125,7 @@ function New-PSMFile {
# this loads functions/aliases as designed
#"" | Out-File -Append -LiteralPath $Path -Encoding utf8
"# Export functions and aliases as required" | Out-File -Append -LiteralPath $Path -Encoding $Encoding
if ($BinaryModule.Count -gt 0 -or $Cmdlet) {
if ($Cmdlet) {
# for now we just export everything
# we may need to change it in the future
"Export-ModuleMember -Function @($Functions) -Alias @($Aliases) -Cmdlet $Cmdlet" | Out-File -Append -LiteralPath $Path -Encoding $Encoding -ErrorAction Stop
Expand Down

0 comments on commit caaf671

Please sign in to comment.