gardebring / PowerColorLS

PowerShell script to display a colorized directory and file listing with icons
MIT License
61 stars 3 forks source link

Import-Module failed at $glyphs["nf-fa-check"] #16

Closed yuxuan-z19 closed 2 years ago

yuxuan-z19 commented 2 years ago

The script fails at line 119 char 30, which is $gitGlyph = $glyphs["nf-fa-check"] I DID install Terminal-Icons and it WORKS pretty fine

Import-Module : 所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerColorLS\1.0.4\Private\GitFunctions.ps1:119 字
符: 30
+         $gitGlyph = $glyphs["nf-fa-check"]
+                              ~~~~~~~~~~~~~
表达式或语句中包含意外的标记“nf-fa-check"]
    }
    $gitColor = (ConvertFrom-RGBColor -RGB ("00FF00"))
    foreach($gitStatusItem in $gitInfo.gitStatusItems){
        $updateGitStatus = $false
        $currentItemForGitCompare = $fileSystemInfo.FullName -Replace "\\", "/"
        if($currentItemForGitCompare -eq $gitStatusItem.path){
            $updateGitStatus = $true
        }elseif($isFolder -and ($gitStatusItem.path.StartsWith($currentItemForGitCompare,'CurrentCultureIgnoreCase'))){
            $updateGitStatus = $true
        }
        if($updateGitStatus){
            switch($gitStatusItem.status){
                "??" {
                    if($hideIcons){
                        $gitGlyph = "?";
                    }else{
                        $gitGlyph = $glyphs["nf-fa-question"]
                    }
                    $gitColor = (ConvertFrom-RGBColor -RGB ("FF0000"))
                }
                default{
                    $gitGlyph = $gitStatusItem.status
                    $gitColor = (ConvertFrom-RGBColor -RGB ("FFFF00"))
                }
            }
        }
    }
    $gitColorAndIcon = "${gitColor}${gitGlyph}”。
所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerColorLS\1.0.4\Private\GitFunctions.ps1:149 字符: 48
+     $gitColorAndIcon = "${gitColor}${gitGlyph} "
+                                                ~
字符串缺少终止符: "。
所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerColorLS\1.0.4\Private\GitFunctions.ps1:116 字符: 19
+     if($hideIcons){
+                   ~
语句块或类型定义中缺少右“}”。
所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerColorLS\1.0.4\Private\GitFunctions.ps1:97 字符: 29
+ function Get-GitColorAndIcon{
+                             ~
语句块或类型定义中缺少右“}”。
所在位置 行:1 字符: 1
+ Import-Module PowerColorLS
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Import-Module], ParseException
    + FullyQualifiedErrorId : UnexpectedToken,Microsoft.PowerShell.Commands.ImportModuleCommand

Updated As mentioned in Pull Request #15 , change encoding of GitFunctions.ps1 from UTF-8 to GBK/GB2312 (system's default encoding)