Functions/Get-RepoNamespaces.ps1

function Get-RepoNamespaces {
    param (
        [string]
        [Parameter(HelpMessage = "The service hosting your repository (e.g. github.com)")]
        [ValidateSet("github.com", "dev.azure.com", "gitlab.com", "bitbucket.org")]
        $Service = "github.com",

        [string]
        [Parameter(HelpMessage = "The directory within which your repositories will be checked out (e.g. /src/)")]
        $Path = $GitTool.Directory
    )

    $servicePath = [System.IO.Path]::Combine($Path, $Service)

    Get-ChildItem -Path $servicePath -Directory -Depth 0 | ForEach-Object {
        $_.FullName.Substring($servicePath.Length).Replace([System.IO.Path]::DirectorySeparatorChar, "/").Trim("/")
    } | Sort-Object -Unique
}