ts

package module
v0.0.0-...-78ecb04 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2017 License: MIT Imports: 2 Imported by: 99 modules, 114 packages

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

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

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
⌂ 换网址