gput

package module
v0.0.0-...-ebaca00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2016 License: MIT Imports: 4 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Gput

Golang port of the tput unix command

Install
$ go get github.com/maxmclau/gput
Usage
package main

import (
  "fmt"
  "github.com/maxmclau/gput"
)

func main() {
  gput.Cup(6, 6)
  gput.Setab(128)

  fmt.Printf("%v Gput Colors Available", gput.Colors());
}
Print Colors
// Prints all available ANSI colors to terminal

package main

import (
  "fmt"
  "github.com/maxmclau/gput"
)

func main() {
  gput.Clear()
  fmt.Printf("%v Available ANSI Colors: ", gput.Colors())
  gput.Cud1()
  
  for i := 0; i < gput.Colors(); i++ {
		gput.Setab(i)
    fmt.Printf(" %v ", i)
    gput.Sgr0()
	}
  gput.Cud1()
}
Set Colors
Function Description
gput.Setab(int color) Set a background to color using ANSI escape
gput.Setb(int color) Set a background color
gput.Setaf(int color) Set a foreground color using ANSI escape
gput.Setf(int color) Set a foreground color
Toggle Modes
Function Description
gput.Bold() Enable bold mode
gput.Dim() Enable half-bright mode
gput.Smul() Disable underline mode
gput.Rmul() Enable underline mode
gput.Rev() Disable reverse mode
gput.Blink() Enable blink mode
gput.Invis() Enable invisible mode
gput.Smso() Enable standout mode (bold on rxvt)
gput.Rmso() Disable standout mode
gput.Sgr0() Turn off all attributes
Cursor Manipulation
Function Description
gput.Cup(int x, int y) Move cursor to screen location x,y (top left is 0,0)
gput.Cub(int chars) Move chars characters left
gput.Cuf(int chars) Move chars characters right
gput.Cuu(int lines) Move lines lines up
gput.Cud(int lines) Move lines lines down
gput.Cub1() Move left one space
gput.Cuf1() Move right one space (non-destructive space)
gput.Cuu1() Move up one line
gput.Cud1() Move down one line
gput.Ll() Last line, first column (if no cup)
gput.Sc() Save the cursor position
gput.Rc() Restore the cursor position
gput.Civis() Hide the cursor
gput.Cnorm() Show the cursor
Character Manipulation
Function Description
gput.Clear() Clear the entire screen and home the cursor
gput.Ich(chars int) Insert #1 characters
gput.Ech(chars int) Erase #1 characters
Return Information
Function Description
gput.Lines()(int lines) Output the number of lines of the terminal
gput.Cols()(int cols) Output the number of columns of the terminal
gput.Colors()(int colors) Output the number of colors supported in the terminal
ToDo
  • Implement the remaining commands from this page.
  • Comment functions in code
  • Remove reliance on go-sh package
  • Generate documentation from GoDoc
License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blink()

func Bold

func Bold()

func Civis

func Civis()

func Clear

func Clear()

func Cnorm

func Cnorm()

func Colors

func Colors() int

func Cols

func Cols() int

func Cub

func Cub(chars int)

func Cub1

func Cub1()

func Cud

func Cud(lines int)

func Cud1

func Cud1()

func Cuf

func Cuf(chars int)

func Cuf1

func Cuf1()

func Cup

func Cup(x int, y int)

func Cuu

func Cuu(lines int)

func Cuu1

func Cuu1()

func Dim

func Dim()

func Dl

func Dl(lines int)

func Ech

func Ech(chars int)

func Ed

func Ed()

func El

func El()

func El1

func El1()

func Ich

func Ich(chars int)

func Il

func Il(lines int)

func Invis

func Invis()

func Lines

func Lines() int

func Ll

func Ll()

func Rc

func Rc()

func Rev

func Rev()

func Rmso

func Rmso()

func Rmul

func Rmul()

func Sc

func Sc()

func Setab

func Setab(color int)

func Setaf

func Setaf(color int)

func Setb

func Setb(color int)

func Setf

func Setf(color int)

func Sgr0

func Sgr0()

func Smso

func Smso()

func Smul

func Smul()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址