Screen
Little helper for clearing the screen using pure Go in a cross-platform way
Install / Use
/learn @inancgumus/ScreenREADME
Screen
The screen package provides an easy way for clearing the screen, moving the cursor and getting the size of the current window in a cross-platform way (Linux, OS X and Windows).
Installation
$ go get -u github.com/inancgumus/screen
Clearing the Screen
You can clear the screen and move the cursor to the top-left corner of the screen. This is good enough to create an animated program (such as an always updating clock or a progress bar).
package main
import (
"fmt"
"time"
"github.com/inancgumus/screen"
)
func main() {
// Clear all the characters on the screen
screen.Clear()
for {
// Moves the cursor to the top-left position of the screen
screen.MoveTopLeft()
// Animate the time always in the same position
fmt.Println(time.Now())
time.Sleep(time.Second)
}
}
Getting the Width and Height
You can get the current terminal width and height. Actually, you don't have to use this package to do that. It's just a simple wrapper over terminal package.
package main
import (
"fmt"
"github.com/inancgumus/screen"
)
func main() {
w, h := screen.Size()
fmt.Printf("Width: %d Height: %d\n", w, h)
}
MIT License
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
344.1kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
