package templates

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



type Tbl struct {
	Column []string
	Colct  int
	Row    []string
	View   string
}


// consumes columns
func Table(t Tbl){
	_ = t
	w, h, err := terminal.GetSize(1)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(w)
	fmt.Println(h)
	//populate(&t)
	//return t
}




func populate(t *Tbl) *Tbl{
	var v string
	for i, c := range t.Column {
		var col string
		var coll string
		col = "| %s                 |"
		coll = "| %s                 |\n"
		var header string
		if i == len(t.Column) -1 {
			fmt.Println()
			header = fmt.Sprintf(coll, c)
			v = v + header
		} else {
			header = fmt.Sprintf(col, c)
			v = v + header
		}


	}
	for i, c := range t.Row {
		if i == len(t.Row[0]) {
			colnl := "\n| %s                 |"
			var header string
			header = fmt.Sprintf(colnl, c)
			v = v + header
		} else {
			cl := "| %s                 |"
			var h string
			h = fmt.Sprintf(cl, c)
			v = v + h
		}

	}
	t.View = v
	return t

}