shiori/cmd/utils.go
2018-02-11 21:00:56 +07:00

29 lines
603 B
Go

package cmd
import (
"github.com/fatih/color"
"golang.org/x/crypto/ssh/terminal"
"os"
)
var (
cIndex = color.New(color.FgHiCyan)
cSymbol = color.New(color.FgHiMagenta)
cTitle = color.New(color.FgHiGreen).Add(color.Bold)
cReadTime = color.New(color.FgHiMagenta)
cURL = color.New(color.FgHiYellow)
cError = color.New(color.FgHiRed)
cExcerpt = color.New(color.FgHiWhite)
cTag = color.New(color.FgHiBlue)
)
func getTerminalWidth() int {
width, _, _ := terminal.GetSize(int(os.Stdin.Fd()))
return width
}
func checkError(err error) {
if err != nil {
panic(err)
}
}