alecthomas / kingpin

CONTRIBUTIONS ONLY: A Go (golang) command line and flag parser
MIT License
3.5k stars 273 forks source link

Wishlist: release guesswidth as its own separate package #300

Closed autarch closed 4 years ago

autarch commented 5 years ago

I've wanted to use the guesswidth package in a couple projects of my own. I don't want to have to depend on all of kingpin (and inherits its deps) just to do this, so I'm copying files around.

It'd be great to see this code released as its own Go package.

autarch commented 4 years ago

@alecthomas Would you be okay with me releasing this package and then making a PR for kingpin to use it?

alecthomas commented 4 years ago

Sure thing!

autarch commented 4 years ago

I did a bit more digging and I realized that the golang.org/x/crypto module already has a package at godoc.org/golang.org/x/crypto/ssh/terminal with a GetSize() func. It's not quite exactly the same, as it can actually return an error and it doesn't check the COLUMNS env var, but for my needs it was good enough.

I'm not sure that it makes sense to have kingpin also use that terminal package as well. But regardless, I'll close this particular issue.