terminaldimensions

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 4 Imported by: 82

README

Go Go Reference Go Report Card

go get github.com/wayneashleyberry/terminal-dimensions
package main

import (
	"fmt"

	terminal "github.com/wayneashleyberry/terminal-dimensions"
)

func main() {
	x, y, err := terminal.Dimensions()
	if err != nil {
		panic(err)
	}

	fmt.Printf("Terminal is %d wide and %d high", x, y)
}

Documentation

Overview

Package terminaldimensions provides simple helper functions to get the width and height of a users terminal.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dimensions added in v1.1.0

func Dimensions() (uint, uint, error)

Dimensions returns the width and height of the terminal.

Example
x, y, err := Dimensions()
if err != nil {
	panic(err)
}

fmt.Printf("Terminal is %d wide and %d high", x, y)
Output:

func Height

func Height() (uint, error)

Height returns the height of the terminal.

func Width

func Width() (uint, error)

Width returns the width of the terminal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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