Libraries/Lib.OS/Lib.OS.psm1

<#
.SYNOPSIS
Return the commonly used name for an OS.
 
.DESCRIPTION
Return the commonly used name for an OS.
 
.PARAMETER Online
True to specify to fetch information from the running OS
 
.PARAMETER Root
The path to the root of an OS.
 
.EXAMPLE
Get-OSName -Online
 
.EXAMPLE
Get-OSName -Root '/mnt/sda3'
 
.EXAMPLE
Get-OSName -Root 'F:\'
 
.NOTES
General notes
#>

function Get-OSName {
    [CmdletBinding()][OutputType([String])]Param (
        [Parameter(ParameterSetName = 'ONLINE')][switch]$Online,
        [Parameter(ParameterSetName = 'ROOT')][string]$Root
    )
    Begin {
        Write-PwShFwOSEnterFunction
    }

    Process {
        switch ($PSCmdlet.ParameterSetName) {
            'ONLINE' {
                $distrib = Get-OSDistrib -Online
                $releaseId = Get-OSReleaseId -Online
                break
            }
            'ROOT' {
                $distrib = Get-OSDistrib -Root $Root
                $releaseId = Get-OSReleaseId -Root $Root
                break
            }
        }
        # return $Distrib + "." + $ReleaseId.replace('.','')
        return "$Distrib $ReleaseId"
   }

    End {
        Write-PwShFwOSLeaveFunction
    }
}