mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-13 16:13:34 +02:00
fix dynamic table output when not on tty
This commit is contained in:
+10
-3
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"text/template"
|
||||
@@ -69,10 +70,16 @@ func TemplateProcessor() *template.Template {
|
||||
},
|
||||
"termWidth": func() int {
|
||||
w, _, err := terminal.GetSize(syscall.Stdout)
|
||||
if err != nil {
|
||||
return 80
|
||||
if err == nil {
|
||||
return w
|
||||
}
|
||||
return w
|
||||
if os.Getenv("COLUMNS") != "" {
|
||||
w, err = strconv.Atoi(os.Getenv("COLUMNS"))
|
||||
}
|
||||
if err == nil {
|
||||
return w
|
||||
}
|
||||
return 120
|
||||
},
|
||||
"sub": func(a, b int) int {
|
||||
return a - b
|
||||
|
||||
Reference in New Issue
Block a user