Cursor
š±ļø Go module to move the terminal cursor in any direction on every operating system.
Install / Use
/learn @atomicgo/CursorREADME
<p align="center"> <strong><a href="https://pkg.go.dev/atomicgo.dev/cursor#section-documentation" target="_blank">Documentation</a></strong> | <strong><a href="https://github.com/atomicgo/atomicgo/blob/main/CONTRIBUTING.md" target="_blank">Contributing</a></strong> | <strong><a href="https://github.com/atomicgo/atomicgo/blob/main/CODE_OF_CONDUCT.md" target="_blank">Code of Conduct</a></strong> </p>
<p align="center"> <img src="https://raw.githubusercontent.com/atomicgo/atomicgo/main/assets/header.png" alt="AtomicGo"> </p> <p align="center"> <table> <tbody> </tbody> </table> </p> <h3 align="center"><pre>go get atomicgo.dev/cursor</pre></h3> <p align="center"> <table> <tbody> </tbody> </table> </p> <!-- gomarkdoc:embed:start --> <!-- Code generated by gomarkdoc. DO NOT EDIT -->
cursor
import "atomicgo.dev/cursor"
Package cursor contains cross-platform methods to move the terminal cursor in different directions. This package can be used to create interactive CLI tools and games, live charts, algorithm visualizations and other updatable output of any kind.
Works niceley with https://github.com/atomicgo/keyboard
Special thanks to github.com/k0kubun/go-ansi which this project is based on.
Index
- func Bottom()
- func Clear()
- func ClearLine()
- func ClearLinesDown(n int)
- func ClearLinesUp(n int)
- func Down(n int)
- func DownAndClear(n int)
- func Hide()
- func HorizontalAbsolute(n int)
- func Left(n int)
- func Move(x, y int)
- func Right(n int)
- func SetTarget(w Writer)
- func Show()
- func StartOfLine()
- func StartOfLineDown(n int)
- func StartOfLineUp(n int)
- func TestCustomIOWriter(t *testing.T)
- func Up(n int)
- func UpAndClear(n int)
- type Area
- func NewArea() Area
- func (area *Area) Bottom()
- func (area *Area) Clear()
- func (area *Area) ClearLinesDown(n int)
- func (area *Area) ClearLinesUp(n int)
- func (area *Area) Down(n int)
- func (area *Area) DownAndClear(n int)
- func (area *Area) Move(x, y int)
- func (area *Area) StartOfLine()
- func (area *Area) StartOfLineDown(n int)
- func (area *Area) StartOfLineUp(n int)
- func (area *Area) Top()
- func (area *Area) Up(n int)
- func (area *Area) UpAndClear(n int)
- func (area *Area) Update(content string)
- func (area Area) WithWriter(writer Writer) Area
- type Cursor
- func NewCursor() *Cursor
- func (c *Cursor) Clear()
- func (c *Cursor) ClearLine()
- func (c *Cursor) Down(n int)
- func (c *Cursor) Hide()
- func (c *Cursor) HorizontalAbsolute(n int)
- func (c *Cursor) Left(n int)
- func (c *Cursor) Right(n int)
- func (c *Cursor) Show()
- func (c *Cursor) Up(n int)
- func (c *Cursor) WithWriter(w Writer) *Cursor
- type Writer
<a name="Bottom"></a>
func Bottom
func Bottom()
Bottom moves the cursor to the bottom of the terminal. This is done by calculating how many lines were moved by Up and Down.
<a name="Clear"></a>
func Clear
func Clear()
Clear clears the current position and moves the cursor to the left.
<a name="ClearLine"></a>
func ClearLine
func ClearLine()
ClearLine clears the current line and moves the cursor to it's start position.
<a name="ClearLinesDown"></a>
func ClearLinesDown
func ClearLinesDown(n int)
ClearLinesDown clears n lines downwards from the current position and moves the cursor.
<a name="ClearLinesUp"></a>
func ClearLinesUp
func ClearLinesUp(n int)
ClearLinesUp clears n lines upwards from the current position and moves the cursor.
<a name="Down"></a>
func Down
func Down(n int)
Down moves the cursor n lines down relative to the current position.
<a name="DownAndClear"></a>
func DownAndClear
func DownAndClear(n int)
DownAndClear moves the cursor down by n lines, then clears the line.
<a name="Hide"></a>
func Hide
func Hide()
Hide the cursor. Don't forget to show the cursor at least at the end of your application with Show. Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal.
<a name="HorizontalAbsolute"></a>
func HorizontalAbsolute
func HorizontalAbsolute(n int)
HorizontalAbsolute moves the cursor to n horizontally. The position n is absolute to the start of the line.
<a name="Left"></a>
func Left
func Left(n int)
Left moves the cursor n characters to the left relative to the current position.
<a name="Move"></a>
func Move
func Move(x, y int)
Move moves the cursor relative by x and y.
<a name="Right"></a>
func Right
func Right(n int)
Right moves the cursor n characters to the right relative to the current position.
<a name="SetTarget"></a>
func SetTarget
func SetTarget(w Writer)
SetTarget sets to output target of the default curser to the provided cursor.Writer (wrapping io.Writer).
<a name="Show"></a>
func Show
func Show()
Show the cursor if it was hidden previously. Don't forget to show the cursor at least at the end of your application. Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal.
<a name="StartOfLine"></a>
func StartOfLine
func StartOfLine()
StartOfLine moves the cursor to the start of the current line.
<a name="StartOfLineDown"></a>
func StartOfLineDown
func StartOfLineDown(n int)
StartOfLineDown moves the cursor down by n lines, then moves to cursor to the start of the line.
<a name="StartOfLineUp"></a>
func StartOfLineUp
func StartOfLineUp(n int)
StartOfLineUp moves the cursor up by n lines, then moves to cursor to the start of the line.
<a name="TestCustomIOWriter"></a>
func TestCustomIOWriter
func TestCustomIOWriter(t *testing.T)
TestCustomIOWriter tests the cursor functi
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
344.4kA 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
99.2kCreate 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.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
