gows

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 3 Imported by: 12 modules, 12 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

gows

Golang library to get the terminal or console window size

Usage

package main

import (
	"fmt"
	"os"

	"github.com/karrick/gows"
)

func main() {
	col, row, err := gows.GetWinSize()
	if err != nil {
		exit(err)
	}
	fmt.Printf("%d %d\n", row, col) // output in same order as `stty size`
}

func exit(err error) {
	if err != nil {
		fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
		os.Exit(1)
	}
	os.Exit(0)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetWinSize

func GetWinSize() (int, int, error)

GetWinSize returns the size of the console window. It returns the number of columns, number of rows, or whatever error was encountered while attempting to get the requested window size. On POSIX it attempts to open the associated controlling terminal from /dev/tty. On Windows it invokes GetConsoleScreenBufferInfo for the process' standard output stream.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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