Skip to content

Commit

Permalink
update progress
Browse files Browse the repository at this point in the history
  • Loading branch information
zan8in committed Jan 3, 2024
1 parent d71c5ae commit d348d21
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 0 additions & 7 deletions v2/pkg/progress/progress.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package progress

import (
"runtime"
"strings"
)

func init() {
if runtime.GOOS == "windows" {
enableVirtualTerminalProcessing()
}
}

// 进度条
func CreateProgressBar(progress, length int, filled, empty rune) string {
filledCount := progress * length / 100
Expand Down
4 changes: 4 additions & 0 deletions v2/pkg/progress/progress_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (
"golang.org/x/sys/windows"
)

func init() {
enableVirtualTerminalProcessing()
}

func enableVirtualTerminalProcessing() {
handle := windows.Handle(os.Stdout.Fd())

Expand Down

0 comments on commit d348d21

Please sign in to comment.