Giter Site home page Giter Site logo

Stack cells about wego HOT 8 OPEN

schachmat avatar schachmat commented on July 27, 2024 1
Stack cells

from wego.

Comments (8)

schachmat avatar schachmat commented on July 27, 2024

Correct, that is a problem. I have not researched how to reliably and portably detect terminal width in go yet. If you have some hints/ideas, let me know.

from wego.

certifiedloud avatar certifiedloud commented on July 27, 2024

+1

from wego.

BrandonRomano avatar BrandonRomano commented on July 27, 2024

@schachmat, here's a quick program showing how you can detect terminal width.

You might have to run go get golang.org/x/crypto/ssh/terminal before running if you haven't already got this installed.

package main

import (
    "fmt"
    "golang.org/x/crypto/ssh/terminal"
)

func main() {
    width, _, _ := terminal.GetSize(0)
    fmt.Println("Width:", width)
}

Outputs for me:

Width: 159

from wego.

philadams-zz avatar philadams-zz commented on July 27, 2024

πŸ‘

from wego.

pavel-main avatar pavel-main commented on July 27, 2024

@schachmat Take a look at this package - tablewriter

from wego.

schachmat avatar schachmat commented on July 27, 2024

tablewriter does not seem to support correct connections for the vertical and horizontal lines. Also embedding the date between the β€žNoonβ€œ and β€žEveningβ€œ columns can't be done.

from wego.

giuscri avatar giuscri commented on July 27, 2024

Apparently you can elegantly solve the problem using the core package syscall and doing an ioctl β€” but check the parameters you pass, to truly achieve portability among Windows, Linux and OSX (the last two ones behave differently in this case).

Check here

http://stackoverflow.com/a/16576712/2219670

and here

http://unix.stackexchange.com/a/93174/47999

from wego.

philcali avatar philcali commented on July 27, 2024

I don't know how compatible the renderings are, but you might be able to accomplish this with TermUI?

from wego.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.