Skip to content

Commit

Permalink
fixed windows os display
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash-Handa committed Jan 19, 2021
1 parent 2492038 commit a63c74a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/dir/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"log"
"os"
"path/filepath"
"runtime"
"sort"
"strings"
"time"
Expand All @@ -16,6 +17,7 @@ import (
"github.com/Yash-Handa/logo-ls/internal/api"
"github.com/Yash-Handa/logo-ls/internal/ctw"
"github.com/Yash-Handa/logo-ls/internal/sysState"
"github.com/mattn/go-colorable"
)

// create the open dir icon
Expand Down Expand Up @@ -216,7 +218,11 @@ func New_Recussion(d *os.File) {
sysState.ExitCode(sysState.Code_Minor)
}
// print the info of the files of the directory
io.Copy(os.Stdout, dd.Print())
var out io.Writer = os.Stdout
if runtime.GOOS == "windows" {
out = colorable.NewColorableStdout()
}
io.Copy(out, dd.Print())
if len(dd.dirs) == 0 {
return
}
Expand Down

0 comments on commit a63c74a

Please sign in to comment.