2018-01-28 14:55:43 +08:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/fatih/color"
|
2018-01-31 11:59:27 +08:00
|
|
|
"golang.org/x/crypto/ssh/terminal"
|
|
|
|
"os"
|
2018-01-28 14:55:43 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|