mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Appease the linter
This commit is contained in:
parent
20a44c5025
commit
c235780eee
7 changed files with 12 additions and 18 deletions
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// isGitHubURL tests a string to determine if it is a well-structured GitHub URL
|
||||
// isGitHubURL tests a string to determine if it is a well-structured GitHub URL.
|
||||
func isGitHubURL(s string) (string, bool) {
|
||||
if strings.HasPrefix(s, "github.com/") {
|
||||
s = "https://" + s
|
||||
|
@ -21,7 +21,7 @@ func isGitHubURL(s string) (string, bool) {
|
|||
return u.String(), strings.ToLower(u.Host) == "github.com"
|
||||
}
|
||||
|
||||
// findGitHubREADME tries to find the correct README filename in a repository
|
||||
// findGitHubREADME tries to find the correct README filename in a repository.
|
||||
func findGitHubREADME(s string) (*source, error) {
|
||||
u, err := url.ParseRequestURI(s)
|
||||
if err != nil {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// isGitLabURL tests a string to determine if it is a well-structured GitLab URL
|
||||
// isGitLabURL tests a string to determine if it is a well-structured GitLab URL.
|
||||
func isGitLabURL(s string) (string, bool) {
|
||||
if strings.HasPrefix(s, "gitlab.com/") {
|
||||
s = "https://" + s
|
||||
|
@ -21,7 +21,7 @@ func isGitLabURL(s string) (string, bool) {
|
|||
return u.String(), strings.ToLower(u.Host) == "gitlab.com"
|
||||
}
|
||||
|
||||
// findGitLabREADME tries to find the correct README filename in a repository
|
||||
// findGitLabREADME tries to find the correct README filename in a repository.
|
||||
func findGitLabREADME(s string) (*source, error) {
|
||||
u, err := url.ParseRequestURI(s)
|
||||
if err != nil {
|
||||
|
|
|
@ -31,7 +31,7 @@ func (d *DocTypeSet) Add(t ...DocType) int {
|
|||
return len(*d)
|
||||
}
|
||||
|
||||
// Had returns whether or not the set contains the given DocTypes.
|
||||
// Contains returns whether or not the set contains the given DocTypes.
|
||||
func (d DocTypeSet) Contains(m ...DocType) bool {
|
||||
matches := 0
|
||||
for _, t := range m {
|
||||
|
|
|
@ -35,7 +35,7 @@ var (
|
|||
statusBarNoteFg = common.NewColorPair("#7D7D7D", "#656565")
|
||||
statusBarBg = common.NewColorPair("#242424", "#E6E6E6")
|
||||
|
||||
// Styling funcs
|
||||
// Styling funcs.
|
||||
statusBarScrollPosStyle = newStyle(common.NewColorPair("#5A5A5A", "#949494"), statusBarBg, false)
|
||||
statusBarNoteStyle = newStyle(statusBarNoteFg, statusBarBg, false)
|
||||
statusBarHelpStyle = newStyle(statusBarNoteFg, common.NewColorPair("#323232", "#DCDCDC"), false)
|
||||
|
|
13
ui/stash.go
13
ui/stash.go
|
@ -237,7 +237,7 @@ func (m *stashModel) addMarkdowns(mds ...*markdown) {
|
|||
}
|
||||
}
|
||||
|
||||
// Find a local markdown by its path and replace it
|
||||
// Find a local markdown by its path and replace it.
|
||||
func (m *stashModel) replaceLocalMarkdown(localPath string, newMarkdown *markdown) error {
|
||||
var found bool
|
||||
|
||||
|
@ -576,7 +576,7 @@ func (m stashModel) update(msg tea.Msg) (stashModel, tea.Cmd) {
|
|||
return m, tea.Batch(cmds...)
|
||||
}
|
||||
|
||||
// Updates for when a user is browsing the markdown listing
|
||||
// Updates for when a user is browsing the markdown listing.
|
||||
func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd {
|
||||
var cmds []tea.Cmd
|
||||
|
||||
|
@ -780,7 +780,6 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd {
|
|||
func (m *stashModel) handleDeleteConfirmation(msg tea.Msg) tea.Cmd {
|
||||
if msg, ok := msg.(tea.KeyMsg); ok {
|
||||
switch msg.String() {
|
||||
|
||||
// Confirm deletion
|
||||
case "y":
|
||||
if m.selectionState != selectionPromptingDelete {
|
||||
|
@ -818,14 +817,13 @@ func (m *stashModel) handleDeleteConfirmation(msg tea.Msg) tea.Cmd {
|
|||
default:
|
||||
// Any other keys cancels deletion
|
||||
m.selectionState = selectionIdle
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Updates for when a user is in the filter editing interface
|
||||
// Updates for when a user is in the filter editing interface.
|
||||
func (m *stashModel) handleFiltering(msg tea.Msg) tea.Cmd {
|
||||
var cmds []tea.Cmd
|
||||
|
||||
|
@ -1032,9 +1030,8 @@ func (m stashModel) headerView() string {
|
|||
if loading && noMarkdowns {
|
||||
if m.stashedOnly() {
|
||||
return common.Subtle("Loading your stash...")
|
||||
} else {
|
||||
return common.Subtle("Looking for stuff...") + maybeOffline
|
||||
}
|
||||
return common.Subtle("Looking for stuff...") + maybeOffline
|
||||
}
|
||||
|
||||
localItems := m.countMarkdowns(LocalDoc)
|
||||
|
@ -1491,7 +1488,7 @@ func filterMarkdowns(m stashModel) tea.Cmd {
|
|||
|
||||
// ETC
|
||||
|
||||
// Delete a markdown from a slice of markdowns
|
||||
// Delete a markdown from a slice of markdowns.
|
||||
func deleteMarkdown(markdowns []*markdown, target *markdown) ([]*markdown, error) {
|
||||
index := -1
|
||||
|
||||
|
|
|
@ -100,9 +100,7 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
|||
}
|
||||
gutter = " "
|
||||
date = dimBrightGrayFg(date)
|
||||
|
||||
} else {
|
||||
|
||||
icon = greenFg(icon)
|
||||
if title == noMemoTitle {
|
||||
title = brightGrayFg(title)
|
||||
|
@ -113,7 +111,6 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
|||
gutter = " "
|
||||
date = brightGrayFg(date)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fmt.Fprintf(b, "%s %s%s\n", gutter, icon, title)
|
||||
|
|
2
ui/ui.go
2
ui/ui.go
|
@ -135,7 +135,7 @@ const (
|
|||
keygenFinished
|
||||
)
|
||||
|
||||
// General stuff we'll need to access in all models
|
||||
// General stuff we'll need to access in all models.
|
||||
type general struct {
|
||||
cfg Config
|
||||
cc *charm.Client
|
||||
|
|
Loading…
Reference in a new issue