Documentation
¶
Index ¶
- Variables
- func CheckToken()
- func Exit(message ...interface{})
- func FindIndex(list []string, item string) int
- func FormatDate(date string) string
- func Linkify(text, href string) string
- func Listify[T any](list []T) string
- func OpenBrowser(url string) error
- func RenderAPIErrors(errors []Error)
- func RenderStatusBar(width int, author string, readTime int, published string, ...) string
- func RenderSuccess(message string)
- func RenderTitle(title string, width int) string
- func SetToken(token string, isSearchToken bool)
- func SetupConfig()
- type Error
- type Post
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF8080")) SuccessStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#80FF80")) InfoStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#8080FF")) RowStyle = lipgloss.NewStyle().Padding(0, 1) UsernameStyle = RowStyle.Copy().Foreground(lipgloss.Color("244")) LabelColStyle = RowStyle.Copy().Foreground(lipgloss.Color("99")) ActiveTabStyle = RowStyle.Copy(). Background(lipgloss.Color("99")). Foreground(lipgloss.Color("#fff")). Margin(1, 0, 0, 2) InactiveTabStyle = RowStyle.Copy().Margin(1, 0, 0, 2).Background(lipgloss.Color("#353533")) TitleStyle = func() lipgloss.Style { b := lipgloss.RoundedBorder() b.Right = "├" return RowStyle.Copy().BorderStyle(b).Foreground(lipgloss.Color("99")) }() AuthorStyle = lipgloss.NewStyle(). Background(lipgloss.Color("99")). Foreground(lipgloss.Color("#fff")). Padding(0, 1). MarginLeft(2) ErrorCodes = map[string]string{ "GRAPHQL_VALIDATION_FAILED": "GraphQL query is invalid.", "UNAUTHENTICATED": "No token set. Please run 'hashnode auth <token>' to set a token.", "FORBIDDEN": "Not allowed to access this resource.", "BAD_USER_INPUT": "User input is invalid.", "NOT_FOUND": "Resource not found.", } )
Functions ¶
func CheckToken ¶
func CheckToken()
func FormatDate ¶
func OpenBrowser ¶
func RenderAPIErrors ¶
func RenderAPIErrors(errors []Error)
func RenderStatusBar ¶
func RenderSuccess ¶
func RenderSuccess(message string)
func RenderTitle ¶
func SetupConfig ¶
func SetupConfig()
Types ¶
type Post ¶
type Post struct { Id string `json:"id"` Title string `json:"title"` Brief string `json:"brief"` PublishedAt string `json:"publishedAt"` Author struct { Name string `json:"name"` } `json:"author"` URL string `json:"url"` ReadTimeInMinutes int `json:"readTimeInMinutes"` Content struct { Markdown string `json:"markdown"` } `json:"content"` }
Click to show internal directories.
Click to hide internal directories.