Skip to content

Commit

Permalink
修复windows清屏错误
Browse files Browse the repository at this point in the history
  • Loading branch information
iikira committed Jul 24, 2018
1 parent 3c3c452 commit b7b6404
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/pcsinit/pcsinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pcsinit

import (
"github.com/urfave/cli"
_ "unsafe" // allow go:linkname
_ "unsafe" // for go:linkname
)

var (
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func init() {
func main() {
defer pcsconfig.Config.Close()

line := pcsliner.NewLiner()
app := cli.NewApp()
app.Name = "BaiduPCS-Go"
app.Version = Version
Expand Down Expand Up @@ -134,8 +135,7 @@ func main() {
pcsverbose.Verbosef("VERBOSE: 这是一条调试信息\n\n")

var (
err error
line = pcsliner.NewLiner()
err error
)

line.History, err = pcsliner.NewLineHistory(historyFilePath)
Expand Down Expand Up @@ -1695,7 +1695,7 @@ func main() {
Description: "清空控制台屏幕",
Category: "其他",
Action: func(c *cli.Context) error {
pcsliner.ClearScreen()
pcsliner.ClearScreen(line.State)
return nil
},
},
Expand Down
6 changes: 3 additions & 3 deletions pcsliner/clear.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package pcsliner

import (
"github.com/peterh/liner"
_ "unsafe" // allow go:linkname
_ "unsafe" // for go:linkname
)

//go:linkname eraseScreen github.com/iikira/BaiduPCS-Go/vendor/github.com/peterh/liner.(*State).eraseScreen
func eraseScreen(s *liner.State)

// ClearScreen 清空屏幕
func ClearScreen() {
eraseScreen(nil)
func ClearScreen(s *liner.State) {
eraseScreen(s)
}

0 comments on commit b7b6404

Please sign in to comment.