screen

package module
v0.0.0-...-6fa7bb4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: MIT Imports: 3 Imported by: 17

README

About

Cross platform (Linux, OS X and Windows) clear shell screen written in Go lang.

Author

Aditya Hajare (Linkedin).

Installation

$ go get -u github.com/aditya43/clear-shell-screen-golang

How To Use?

package main

import (
	"fmt"
	"time"

	"github.com/aditya43/clear-shell-screen-golang"
)

func main() {
	// Clear all the characters on the screen
	screen.Clear()

	for {
		// Moves the cursor to the top-left position of the screen
		screen.MoveTopLeft()

		// Animate the time always in the same position
		fmt.Println(time.Now())

		time.Sleep(time.Second)
	}
}

Width and Height

To get the current terminal width and height.

package main

import (
	"fmt"
	"github.com/aditya43/clear-shell-screen-golang"
)

func main() {
	w, h := screen.Size()

	fmt.Printf("Width: %d Height: %d\n", w, h)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear clears the screen

func MoveTopLeft

func MoveTopLeft()

MoveTopLeft moves the cursor to the top left position of the screen

func Size

func Size() (int, int)

Size returns the width and height of the terminal screen

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