Skip to content

Commit

Permalink
new log structure & extra features
Browse files Browse the repository at this point in the history
  • Loading branch information
cipheras committed Nov 2, 2020
1 parent dcb231d commit 598f25d
Showing 1 changed file with 23 additions and 37 deletions.
60 changes: 23 additions & 37 deletions gohelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@ import (
"os"
)

/*
RESET
RED
GREEN
YELLOW
BLUE
PURPLE
CYAN
WHITE
BGBLACK
BOLD
UNDERLINE
BLINK
CLEAR
LEFT
*/
const (
// ANSI color codes
RESET = "\033[0m"
Expand All @@ -37,7 +21,6 @@ const (
UNDERLINE = "\033[4m"
BLINK = "\033[5m"
CLEAR = "\033[2J\033[H"
LEFT = "\033[1000D"
)

const (
Expand Down Expand Up @@ -113,27 +96,30 @@ func Cwindows() error {
return nil
}

/*
Up: \u001b[{n}A moves cursor up by n
Down: \u001b[{n}B moves cursor down by n
Right: \u001b[{n}C moves cursor right by n
Left: \u001b[{n}D moves cursor left by n
const (
Up = "\u001b[{n}A" //moves cursor up by n
Down = "\u001b[{n}B" //moves cursor down by n
Right = "\u001b[{n}C" //moves cursor right by n
Left = "\u001b[{n}D" //moves cursor left by n

NextLine = "\u001b[{n}E" //moves cursor to beginning of line n lines down
PrevLine = "\u001b[{n}F" //moves cursor to beginning of line n lines down

Next Line: \u001b[{n}E moves cursor to beginning of line n lines down
Prev Line: \u001b[{n}F moves cursor to beginning of line n lines down
SetColumn = "\u001b[{n}G" //moves cursor to column n
SetPosition = "\u001b[{n};{m}H" //moves cursor to row n column m

Set Column: \u001b[{n}G moves cursor to column n
Set Position: \u001b[{n};{m}H moves cursor to row n column m
ClearScreen = "\u001b[{n}J"
// clears the screen
// n=0 clears from cursor until end of screen,
// n=1 clears from cursor to beginning of screen
// n=2 clears entire screen

Clear Screen: \u001b[{n}J clears the screen
n=0 clears from cursor until end of screen,
n=1 clears from cursor to beginning of screen
n=2 clears entire screen
Clear Line: \u001b[{n}K clears the current line
n=0 clears from cursor to end of line
n=1 clears from cursor to start of line
n=2 clears entire line
ClearLine = "\u001b[{n}K"
// clears the current line
// n=0 clears from cursor to end of line
// n=1 clears from cursor to start of line
// n=2 clears entire line

Save Position: \u001b[{s} saves the current cursor position
Save Position: \u001b[{u} restores the cursor to the last saved position
*/
SavePosition = "\u001b[s" //saves the current cursor position
RestorePosition = "\u001b[u" //restores the cursor to the last saved position
)

0 comments on commit 598f25d

Please sign in to comment.