Fork Notesium source and restructure into Go package layout

Initial fork of github.com/alonswartz/notesium into librenotes:
- Source moved to internal/notesium/ (package notesium)
- Thin entry point at cmd/librenotes/main.go
- Module renamed to git.librete.ch/public/librenotes
- main() exposed as notesium.Run()
- LICENSE preserved (MIT), NOTICE added with attribution
- Web assets and completion.bash co-located with embedding code
  to satisfy go:embed path constraints

Closes #3, #34, #35.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-28 21:52:25 +02:00
co-authored by Claude Opus 4.7
parent b816914b9c
commit df9407dd8d
63 changed files with 7391 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
package notesium
import (
"fmt"
fzf "github.com/junegunn/fzf/src"
)
type channelWriter struct {
ch chan string
}
func (cw *channelWriter) Write(p []byte) (n int, err error) {
str := string(p) // Convert bytes to string
cw.ch <- str // Send to channel
return len(p), nil
}
func runFinder(inputChan chan string, opts []string) ([]string, int, error) {
options, err := fzf.ParseOptions(false, opts)
if err != nil {
return nil, 2, fmt.Errorf("fzf error: %w", err)
}
outputChan := make(chan string)
resultChan := make(chan struct {
code int
err error
}, 1)
options.Input = inputChan
options.Output = outputChan
go func() {
code, runErr := fzf.Run(options)
close(outputChan)
resultChan <- struct {
code int
err error
}{code, runErr}
close(resultChan)
}()
var lines []string
for line := range outputChan {
lines = append(lines, line)
}
result := <-resultChan
return lines, result.code, result.err
}