Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

Expand Down Expand Up @@ -59,7 +57,7 @@ jobs:
run: govulncheck ./...
- name: Install gosec
# Pin to a specific version — update manually or watch https://github.com/securego/gosec/releases
run: go install github.com/securego/gosec/v2/cmd/gosec@v2.21.4
run: go install github.com/securego/gosec/v2/cmd/gosec@v2.22.11
- name: Run gosec
run: gosec -severity medium -confidence medium -exclude=G204,G301,G302,G304,G306 ./...

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module github.com/Yakitrak/notesmd-cli

go 1.24
go 1.25.8

require (
github.com/adrg/frontmatter v0.2.0
github.com/ktr0731/go-fuzzyfinder v0.9.0
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.11.1
golang.org/x/term v0.31.0
gopkg.in/yaml.v3 v3.0.1
)

Expand All @@ -26,7 +27,6 @@ require (
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/pflag v1.0.9 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/term v0.31.0 // indirect
golang.org/x/text v0.24.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
)
8 changes: 4 additions & 4 deletions pkg/actions/search_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ func SearchNotesContentWithOptions(vault obsidian.VaultManager, note obsidian.No
}

if len(matches) == 0 {
fmt.Fprintf(output, "No notes found containing '%s'\n", searchTerm)
_, _ = fmt.Fprintf(output, "No notes found containing '%s'\n", searchTerm)
return nil
}

if len(matches) == 1 {
fmt.Fprintf(output, "Opening note: %s\n", matches[0].FilePath)
_, _ = fmt.Fprintf(output, "Opening note: %s\n", matches[0].FilePath)
if useEditor {
filePath := filepath.Join(vaultPath, matches[0].FilePath)
return obsidian.OpenInEditor(filePath)
Expand All @@ -117,7 +117,7 @@ func SearchNotesContentWithOptions(vault obsidian.VaultManager, note obsidian.No
selectedMatch := matches[index]
if useEditor {
filePath := filepath.Join(vaultPath, selectedMatch.FilePath)
fmt.Fprintf(output, "Opening note: %s\n", selectedMatch.FilePath)
_, _ = fmt.Fprintf(output, "Opening note: %s\n", selectedMatch.FilePath)
return obsidian.OpenInEditor(filePath)
}
obsidianUri := uri.Construct(ObsOpenUrl, map[string]string{
Expand Down Expand Up @@ -159,7 +159,7 @@ func printMatches(matches []obsidian.NoteMatch, searchTerm string, format string
return nil
}
for _, match := range matches {
fmt.Fprintln(output, formatMatchForList(match))
_, _ = fmt.Fprintln(output, formatMatchForList(match))
}
return nil
case searchContentFormatJSON:
Expand Down
4 changes: 2 additions & 2 deletions pkg/obsidian/uri.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func (u *Uri) Construct(baseUri string, params map[string]string) string {
for key, value := range params {
if value != "" && value != "false" {
if uri == baseUri {
uri += "?" + key + "=" + url.PathEscape(value)
uri += "?" + key + "=" + url.QueryEscape(value)
} else {
uri += "&" + key + "=" + url.PathEscape(value)
uri += "&" + key + "=" + url.QueryEscape(value)
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/obsidian/uri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func TestUriConstruct(t *testing.T) {
{"Two keys", map[string]string{"key1": "value1", "key2": "value2"}, map[string]string{"key1": "value1", "key2": "value2"}},
{"Empty value", map[string]string{"key": ""}, nil},
{"Mix of empty and non-empty values", map[string]string{"key1": "value1", "key2": ""}, map[string]string{"key1": "value1"}},
{"Value with ampersand", map[string]string{"file": "R&D Notes"}, map[string]string{"file": "R&D Notes"}},
{"Value with hash", map[string]string{"file": "section#heading"}, map[string]string{"file": "section#heading"}},
{"Value with equals", map[string]string{"file": "a=b"}, map[string]string{"file": "a=b"}},
{"Value with spaces and special chars", map[string]string{"file": "my notes & ideas", "vault": "test#vault"}, map[string]string{"file": "my notes & ideas", "vault": "test#vault"}},
}

for _, test := range tests {
Expand Down