Skip to content

Commit

Permalink
docs: autoupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed May 8, 2021
1 parent c9e4c6a commit e236c61
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 45 deletions.
103 changes: 58 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</a>

<a href="https://codecov.io/gh/atomicgo/cursor">
<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-16-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-0-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
</a>

<a href="https://github.com/atomicgo/cursor/issues">
Expand Down Expand Up @@ -48,7 +48,12 @@

## Description

Package cursor contains methods to move the cursor inside a terminal.
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 visualization and other updatable output of
any kind.

Special thanks to github.com/k0kubun/go-ansi which this project is based on.

## Install

Expand All @@ -64,111 +69,119 @@ import "github.com/atomicgo/cursor"

## Usage

#### func ClearLine
#### func Bottom

```go
func ClearLine()
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.

#### func ClearLines
#### func ClearLine

```go
func ClearLines(n int)
func ClearLine()
```
ClearLine clears the current line and moves the cursor to it's start position.

#### func ClearScreen
#### func Down

```go
func ClearScreen()
func Down(n int)
```
Down moves the cursor n lines down relative to the current position.

#### func CloseAlternativeScreen
#### func DownAndClear

```go
func CloseAlternativeScreen()
func DownAndClear(n int)
```
DownAndClear moves the cursor down by n lines, then clears the line.

#### func Down
#### func Hide

```go
func Down(n int)
func Hide()
```
Hide the cursor. Don't forget to show the cursor atleast at the end of your
application with Show. Otherwise the user might have a terminal with a
permanently hidden cursor, until he reopens the terminal.

Down moves the cursor n cells down. If the cursor is already at the edge of the screen, this has no effect.

#### func Hide
#### func HorizontalAbsolute

```go
func Hide()
func HorizontalAbsolute(n int)
```
HorizontalAbsolute moves the cursor to n horizontally. The position n is
absolute to the start of the line.

#### func Left

```go
func Left(n int)
```

Left moves the cursor n cells left. If the cursor is already at the edge of the screen, this has no effect.
Left moves the cursor n characters to the left relative to the current position.

#### func Move

```go
func Move(row int, column int)
```

Move moves the cursor to a specific row and column.

#### func NextLine

```go
func NextLine(n int)
func Move(x, y int)
```
Move moves the cursor relative by x and y

#### func OpenAlternativeScreen
#### func Right

```go
func OpenAlternativeScreen()
func Right(n int)
```
Right moves the cursor n characters to the right relative to the current
position.

#### func PrevLine
#### func Show

```go
func PrevLine(n int)
func Show()
```
Show the cursor if it was hidden previously. Don't forget to show the cursor
atleast at the end of your application. Otherwise the user might have a terminal
with a permanently hidden cursor, until he reopens the terminal.

#### func RestorePosition
#### func StartOfLine

```go
func RestorePosition()
func StartOfLine()
```
StartOfLine moves the cursor to the start of the current line.

#### func Right
#### func StartOfLineDown

```go
func Right(n int)
func StartOfLineDown(n int)
```
StartOfLineDown moves the cursor down by n lines, then moves to cursor to the
start of the line.

Right moves the cursor n cells right. If the cursor is already at the edge of the screen, this has no effect.

#### func SavePosition
#### func StartOfLineUp

```go
func SavePosition()
func StartOfLineUp(n int)
```
StartOfLineUp moves the cursor up by n lines, then moves to cursor to the start
of the line.

#### func Show
#### func Up

```go
func Show()
func Up(n int)
```
Up moves the cursor n lines up relative to the current position.

#### func Up
#### func UpAndClear

```go
func Up(n int)
func UpAndClear(n int)
```

Up moves the cursor n cells up. If the cursor is already at the edge of the screen, this has no effect.
UpAndClear moves the cursor up by n lines, then clears the line.

---

Expand Down
Empty file added go.sum
Empty file.

0 comments on commit e236c61

Please sign in to comment.