Get Screen dimensions via goncurses
This commit is contained in:
parent
b4251237ba
commit
ca3f1947b3
|
@ -9,7 +9,7 @@ import (
|
|||
var cmdGosl = &cobra.Command{
|
||||
Use: "gosl [command]",
|
||||
Short: "Run a gosl instance",
|
||||
Long: `Run a gosl server or client."
|
||||
Long: `Run a gosl server or client.
|
||||
|
||||
For further instructions run 'gosl help [command]'
|
||||
`,
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"code.bitsetter.de/fun/gosl/data"
|
||||
)
|
||||
|
||||
var cmdServer = &cobra.Command{
|
||||
|
@ -15,6 +17,7 @@ var cmdServer = &cobra.Command{
|
|||
|
||||
func runServer(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("running server ...")
|
||||
data.TestNC()
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -1,6 +1,27 @@
|
|||
package data // code.bitsetter.de/fun/gosl/data
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/rthornton128/goncurses"
|
||||
)
|
||||
|
||||
type Screen struct {
|
||||
w, h int
|
||||
data []rune
|
||||
}
|
||||
|
||||
func TestNC() {
|
||||
win, err := goncurses.Init()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
win.Clear()
|
||||
w, h := win.MaxYX()
|
||||
goncurses.End()
|
||||
fmt.Printf("screen: %d x %d", w, h)
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user