5

I am playing with golang and want to create a simple terminal tool (on mac, but it should work on linux too). I need to display character "x" in the center of the terminal window. How can I detect width and height of terminal window and detect its changes?

2 Answers 2

9

A terminal package exists in the Go crypto repository: In particular, check out the GetSize function

6

A lightweight alternative to the usual ncurses option, is termbox-go. This is a pure-go implementation of termbox.

It offers a simple API to get some 'graphical' stuff done in a terminal and is pretty decent as far as support for different terminal implementations goes.

Not the answer you're looking for? Browse other questions tagged or ask your own question.