<commit_before>Write-Verbose -Message '[dotfiles] Importing environment functions ...'

# Configure environment for Cygwin usage
Function Switch-Cygwin {
    [CmdletBinding()]
    Param(
        [ValidateNotNullOrEmpty()]
        [String]$Path="$env:HOMEDRIVE\Cygwin",

        [Switch]$Persist,
        [Switch]$Disable
    )

    if (!$Disable -and !(Test-Path -Path $Path -PathType Container)) {
        throw 'Provided Cygwin path is not a directory: {0}' -f $Path
    }

    if ($Persist -and !$Path.StartsWith($env:USERPROFILE) -and !(Test-IsAdministrator)) {
        throw 'You must have administrator privileges to update the system PATH variable.'
    }

    if (!$Disable) {
        $Operation = 'Add-PathStringElement'
    } else {
        $Operation = 'Remove-PathStringElement'
    }

    $BinPath = Join-Path -Path $Path -ChildPath 'bin'
    $LocalBinPath = Join-Path -Path $Path -ChildPath 'usr\local\bin'

    $env:Path = $env:Path |
        & $Operation -Action Prepend -Element $BinPath |
        & $Operation -Action Prepend -Element $LocalBinPath

    if ($Persist) {
        $Params = @{ }
        if (!$Path.StartsWith($env:USERPROFILE)) {
            $Params['Scope'] = 'Machine'
        }

        Get-EnvironmentVariable -Name Path @Params |
            & $Operation -Action Append -Element $LocalBinPath |
            & $Operation -Action Append -Element $BinPath |
            Set-EnvironmentVariable -Name Path @Params
    }
}

# Configure environment for Go usage
Function Switch-Go {
    [CmdletBinding()]
    Param(
        [ValidateNotNullOrEmpty()]
        [String]$Path="$env:HOMEDRIVE\Go",

        [Switch]$Persist,
        [Switch]$Disable
    )

    if (!$Disable -and !(Test-Path -Path $Path -PathType Container)) {
        throw 'Provided Go path is not a directory: {0}' -f $Path
    }

    if ($Persist -and !$Path.StartsWith($env:USERPROFILE) -and !(Test-IsAdministrator)) {
        throw 'You must have administrator privileges to update the system PATH variable.'
    }

    if (!$Disable) {
        $Operation = 'Add-PathStringElement'
    } else {
        $Operation = 'Remove-PathStringElement'
    }

    $BinPath = Join-Path -Path $Path -ChildPath 'bin'

    $GoPaths = @()
    if ($env:GOPATH) {<commit_msg>Pedantic update to Switch-Go comment<commit_after>Write-Verbose -Message '[dotfiles] Importing environment functions ...'

# Configure environment for Cygwin usage
Function Switch-Cygwin {
    [CmdletBinding()]
    Param(
        [ValidateNotNullOrEmpty()]
        [String]$Path="$env:HOMEDRIVE\Cygwin",

        [Switch]$Persist,
        [Switch]$Disable
    )

    if (!$Disable -and !(Test-Path -Path $Path -PathType Container)) {
        throw 'Provided Cygwin path is not a directory: {0}' -f $Path
    }

    if ($Persist -and !$Path.StartsWith($env:USERPROFILE) -and !(Test-IsAdministrator)) {
        throw 'You must have administrator privileges to update the system PATH variable.'
    }

    if (!$Disable) {
        $Operation = 'Add-PathStringElement'
    } else {
        $Operation = 'Remove-PathStringElement'
    }

    $BinPath = Join-Path -Path $Path -ChildPath 'bin'
    $LocalBinPath = Join-Path -Path $Path -ChildPath 'usr\local\bin'

    $env:Path = $env:Path |
        & $Operation -Action Prepend -Element $BinPath |
        & $Operation -Action Prepend -Element $LocalBinPath

    if ($Persist) {
        $Params = @{ }
        if (!$Path.StartsWith($env:USERPROFILE)) {
            $Params['Scope'] = 'Machine'
        }

        Get-EnvironmentVariable -Name Path @Params |
            & $Operation -Action Append -Element $LocalBinPath |
            & $Operation -Action Append -Element $BinPath |
            Set-EnvironmentVariable -Name Path @Params
    }
}

# Configure environment for Go development
Function Switch-Go {
    [CmdletBinding()]
    Param(
        [ValidateNotNullOrEmpty()]
        [String]$Path="$env:HOMEDRIVE\Go",

        [Switch]$Persist,
        [Switch]$Disable
    )

    if (!$Disable -and !(Test-Path -Path $Path -PathType Container)) {
        throw 'Provided Go path is not a directory: {0}' -f $Path
    }

    if ($Persist -and !$Path.StartsWith($env:USERPROFILE) -and !(Test-IsAdministrator)) {
        throw 'You must have administrator privileges to update the system PATH variable.'
    }

    if (!$Disable) {
        $Operation = 'Add-PathStringElement'
    } else {
        $Operation = 'Remove-PathStringElement'
    }

    $BinPath = Join-Path -Path $Path -ChildPath 'bin'

    $GoPaths = @()
    if ($env:GOPATH) {
{'fraction_non_alphanumeric': 0.1295929592959296, 'fraction_numerical': 0.0008800880088008801, 'mean_word_length': 2.546021840873635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2739634', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1369, 'n_words': 360}