ts

package
v0.3.11-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2016 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

Overview

This module is a Terminal API for the Go Programming Language. The protocols were written in pure Go and works on windows and unix systems

Index

Examples

Constants

View Source
const (
	TIOCGWINSZ = 0x5413
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Size

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

Return System Size

func GetSize

func GetSize() (ws Size, err error)

Get Windows Size

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