shiori/cmd/utils.go

30 lines
603 B
Go
Raw Normal View History

package cmd
import (
"github.com/fatih/color"
2018-01-31 11:59:27 +08:00
"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)
)
2018-01-31 11:59:27 +08:00
func getTerminalWidth() int {
width, _, _ := terminal.GetSize(int(os.Stdin.Fd()))
return width
}
2018-02-11 22:00:56 +08:00
func checkError(err error) {
if err != nil {
panic(err)
}
}