Add multi-depository support with global config
- Implement global CLI config at ~/.config/jade/config.yml - Add jade depo commands (add, list, remove, set-default) - Support depository short names and context-aware detection - Remove tag_prefix config, hardcode + syntax for consistency - Update depository resolution: flag -> context -> default - Auto-initialize .jade/ directory structure when adding depos - Update documentation with new multi-depository workflow
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -52,18 +51,6 @@ func (jd *JadeDepo) SearchContent(query string) ([]string, error) {
|
||||
return results, nil
|
||||
}
|
||||
|
||||
// SearchByTag searches for notes containing a specific tag
|
||||
func (jd *JadeDepo) SearchByTag(tag string) ([]string, error) {
|
||||
// Ensure tag has prefix
|
||||
if !strings.HasPrefix(tag, jd.Config.TagPrefix) {
|
||||
tag = jd.Config.TagPrefix + tag
|
||||
}
|
||||
|
||||
// Use ripgrep to find the tag (escape special regex characters)
|
||||
escapedTag := regexp.QuoteMeta(tag)
|
||||
return jd.SearchContent(escapedTag)
|
||||
}
|
||||
|
||||
// ListAllNotes returns all markdown notes in the depository
|
||||
func (jd *JadeDepo) ListAllNotes() ([]*Note, error) {
|
||||
var notes []*Note
|
||||
@@ -85,7 +72,7 @@ func (jd *JadeDepo) ListAllNotes() ([]*Note, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
note, err := LoadNote(jd.Config.DepoPath, relPath, jd.Config.TagPrefix)
|
||||
note, err := LoadNote(jd.Config.DepoPath, relPath)
|
||||
if err != nil {
|
||||
// Log error but continue
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to load note %s: %v\n", relPath, err)
|
||||
|
||||
Reference in New Issue
Block a user