Add quick switcher (jot switch/open) with fuzzy search and editor launch#15
Add quick switcher (jot switch/open) with fuzzy search and editor launch#15Intina47 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d87c19c65
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func editorCommand(editor string, path string, line int) (*exec.Cmd, error) { | ||
| fields := strings.Fields(editor) | ||
| if len(fields) == 0 { | ||
| return nil, errors.New("editor command is empty") | ||
| } | ||
| cmdName := fields[0] | ||
| args := append([]string{}, fields[1:]...) |
There was a problem hiding this comment.
Handle editor paths that include spaces or quotes
The editor command is split with strings.Fields, which discards quoting and splits on whitespace. If a user sets JOT_EDITOR/EDITOR to a path with spaces (e.g., C:\Program Files\...\notepad++.exe on Windows or a quoted macOS app path), fields[0] becomes a truncated path and exec.Command fails with “file not found,” so jot switch cannot open notes. This is a regression introduced with the new editor launcher and will affect users whose editors live in space-containing paths unless the parsing honors quotes or uses a different mechanism.
Useful? React with 👍 / 👎.
Motivation
Description
switchandopenCLI subcommands and wire them intomainsojot switch(aliasjot open) invokes a minimal TUI flow implemented injotSwitch.parseNote,extractTags,loadNotes) and a relevance-ranked fuzzy matcher (searchNotes,matchScore,fuzzyScore) that considers partial title matches and tags.resolveEditor,editorCommand,openInEditor,supportsLineArg) to open the journal file at the selected note line, honoringJOT_EDITOR,EDITOR, orVISUAL.README.mdand remove an accidental packaged artifact from the repo.TestSearchNotesRanksPartialMatches,TestJotSwitchSearchAndOpen) to validate ranking and the open flow using a scripted editor.Testing
go test ./...and the test suite passed (ok jot 0.020s).searchNotesand the interactive open flow viajotSwitch, both executed as part of the test run.Codex Task