MariusTestModule.psm1

[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
    'PSAvoidAssignmentToAutomaticVariable', 'IsWindows',
    Justification = 'IsWindows doesnt exist in PS5.1'
)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
    'PSUseDeclaredVarsMoreThanAssignments', 'IsWindows',
    Justification = 'IsWindows doesnt exist in PS5.1'
)]
[CmdletBinding()]
param()
$baseName = [System.IO.Path]::GetFileNameWithoutExtension($PSCommandPath)
$script:PSModuleInfo = Import-PowerShellDataFile -Path "$PSScriptRoot\$baseName.psd1"
$script:PSModuleInfo | Format-List | Out-String -Stream | ForEach-Object { Write-Debug $_ }
$scriptName = $script:PSModuleInfo.Name
Write-Debug "[$scriptName] - Importing module"

if ($PSEdition -eq 'Desktop') {
    $IsWindows = $true
}

#region [functions] - [public]
Write-Debug "[$scriptName] - [functions] - [public] - Processing folder"
#region [functions] - [public] - [Get-Greeting]
Write-Debug "[$scriptName] - [functions] - [public] - [Get-Greeting] - Importing"
function Get-Greeting {
    <#
        .SYNOPSIS
        Returns a greeting message.

        .DESCRIPTION
        Returns a simple greeting message for the specified time of day.

        .EXAMPLE
        Get-Greeting -TimeOfDay 'Morning'

        Returns "Good Morning!"
    #>

    [OutputType([string])]
    [CmdletBinding()]
    param (
        # The time of day for the greeting.
        [Parameter()]
        [ValidateSet('Morning', 'Afternoon', 'Evening')]
        [string] $TimeOfDay = 'Morning'
    )
    "Good $TimeOfDay!"
}
Write-Debug "[$scriptName] - [functions] - [public] - [Get-Greeting] - Done"
#endregion [functions] - [public] - [Get-Greeting]
#region [functions] - [public] - [Get-PSModuleTest]
Write-Debug "[$scriptName] - [functions] - [public] - [Get-PSModuleTest] - Importing"
function Get-PSModuleTest {
    <#
        .SYNOPSIS
        Performs tests on a module.

        .DESCRIPTION
        Performs tests on a module.

        .EXAMPLE
        ```pwsh
        Test-PSModule -Name 'World'
        ```

        "Hello, World!"
    #>

    [CmdletBinding()]
    param (
        # Name of the person to greet.
        [Parameter(Mandatory)]
        [string] $Name
    )
    Write-Output "Hello, $Name!"
}
Write-Debug "[$scriptName] - [functions] - [public] - [Get-PSModuleTest] - Done"
#endregion [functions] - [public] - [Get-PSModuleTest]
Write-Debug "[$scriptName] - [functions] - [public] - Done"
#endregion [functions] - [public]

#region Member exporter
$exports = @{
    Alias    = '*'
    Cmdlet   = ''
    Function = @(
        'Get-Greeting'
        'Get-PSModuleTest'
    )
    Variable = ''
}
Export-ModuleMember @exports
#endregion Member exporter