ts

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2015 License: MIT, MIT Imports: 2 Imported by: 0

README

ts (Terminal Size)

Build Status Total views

Simple go Application to get Terminal Size. So Many Implementations do not support windows but ts has full windows support. Run go get github.com/olekukonko/ts to download and install

Example
package main

import (
	"fmt"
	"github.com/olekukonko/ts"
)

func main() {
	size, _ := ts.GetSize()
	fmt.Println(size.Col())  // Get Width
	fmt.Println(size.Row())  // Get Height
	fmt.Println(size.PosX()) // Get X position
	fmt.Println(size.PosY()) // Get Y position
}

See Documentation

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CONSOLE_SCREEN_BUFFER_INFO

type CONSOLE_SCREEN_BUFFER_INFO struct {
	DwSize              COORD
	DwCursorPosition    COORD
	WAttributes         uint16
	SrWindow            SMALL_RECT
	DwMaximumWindowSize COORD
}
Contains information about a console screen buffer.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms682093(v=vs.85).aspx

type COORD

type COORD struct {
	X, Y uint16
}

Defines the coordinates of a character cell in a console screen buffer. The origin of the coordinate system (0,0) is at the top, left cell of the buffer. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms682119(v=vs.85).aspx

type SMALL_RECT

type SMALL_RECT struct {
	Left, Top, Right, Bottom uint16
}

Defines the coordinates of the upper left and lower right corners of a rectangle. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms686311(v=vs.85).aspx

type Size

type Size struct {
	// contains filtered or unexported fields
}

Return System Size

func GetSize

func GetSize() (ws Size, err error)
Example
size, _ := GetSize()
fmt.Println(size.Col())  // Get Width
fmt.Println(size.Row())  // Get Height
fmt.Println(size.PosX()) // Get X position
fmt.Println(size.PosY()) // Get Y position
Output:

func (Size) Col

func (w Size) Col() int

Get Terminal Width

func (Size) PosX

func (w Size) PosX() int

Get Position X

func (Size) PosY

func (w Size) PosY() int

Get Position Y

func (Size) Row

func (w Size) Row() int

Get Terminal Height

Jump to

Keyboard shortcuts

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