GithubHelp home page GithubHelp logo

nathan-fiscaletti / consolesize-go Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 5.0 10 KB

A library for determining the size of the Console in Go (GoLang) (supports both Windows and Unix systems)

License: MIT License

Go 100.00%
console go golang unix windows

consolesize-go's Introduction

Hi there! ๐Ÿ‘‹

Seasoned Senior Software Engineer | Open Source Enthusiast | Tech Leader | 15 Years of Crafting Digital Solutions

Sponsor Me! Total time coded since Jul 21 2022 Github Followers

I'm Nathan. I live in Omaha Nebraska and currently working at Pulsar Informatics.
In my free time I work on all sorts of various open-source projects.

Connect with me

https://www.linkedin.com/in/nathanial-fiscaletti-91120b208 ย  ย  email

consolesize-go's People

Contributors

nathan-fiscaletti avatar rbrt-weiler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

consolesize-go's Issues

Headless mode?

Is there any way to get this to return the correct width in a headless terminal? I'm attempting to use this library inside a binary inside a Dockerfile and it returns 0,0 there.

Returns 0,0 for tests

It works completely fine when executed with go run main.go, even if the consolesize-go is imported down in other imported libraries from main.go. Even the binaries work fine.

However, it doesn't seem to do that for go tests. I wrote a simple test in a library_test.go file to show this:

package main

import (
	"fmt"
	"testing"

	"github.com/nathan-fiscaletti/consolesize-go"
)

func TestLibrary(t *testing.T) {
	cols, rows := consolesize.GetConsoleSize()
	fmt.Printf("Rows: %v\n", rows)
	fmt.Printf("Cols: %v\n\n", cols)

	t.FailNow()
}

When I execute go test library_test.go, I get the following output:


I've separated a chunk of my cli tool to be used as a library, but I can't write any tests for it due to this issue. Any idea how I could resolve this?

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.