Skip to content

Commit

Permalink
fix 288, 增加清空控制台
Browse files Browse the repository at this point in the history
  • Loading branch information
iikira committed Jul 24, 2018
1 parent c38fa87 commit 3c3c452
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,18 @@ func main() {
},
},
},
{
Name: "clear",
Aliases: []string{"cls"},
Usage: "清空控制台",
UsageText: app.Name + " clear",
Description: "清空控制台屏幕",
Category: "其他",
Action: func(c *cli.Context) error {
pcsliner.ClearScreen()
return nil
},
},
{
Name: "quit",
Aliases: []string{"exit"},
Expand Down
14 changes: 14 additions & 0 deletions pcsliner/clear.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pcsliner

import (
"github.com/peterh/liner"
_ "unsafe" // allow 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)
}
Empty file added pcsliner/clear.s
Empty file.

0 comments on commit 3c3c452

Please sign in to comment.