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:
2026-01-03 16:25:23 +01:00
parent 0ebfaf835d
commit 1d87d93172
9 changed files with 515 additions and 158 deletions
+7 -11
View File
@@ -20,7 +20,7 @@ type Note struct {
}
// LoadNote reads a note from the filesystem and parses its content
func LoadNote(depoPath, notePath string, tagPrefix string) (*Note, error) {
func LoadNote(depoPath, notePath string) (*Note, error) {
fullPath := filepath.Join(depoPath, notePath)
// Get file info
@@ -48,8 +48,8 @@ func LoadNote(depoPath, notePath string, tagPrefix string) (*Note, error) {
note.Title = strings.TrimSuffix(filepath.Base(notePath), filepath.Ext(notePath))
}
// Parse tags
note.Tags = parseTags(string(content), tagPrefix)
// Parse tags (hardcoded to + prefix)
note.Tags = parseTags(string(content))
// Parse links
note.Links = parseLinks(string(content))
@@ -69,14 +69,10 @@ func parseTitle(content string) string {
return ""
}
// parseTags extracts tags from markdown content based on the tag prefix
func parseTags(content string, tagPrefix string) []string {
// Escape special regex characters in tagPrefix
escapedPrefix := regexp.QuoteMeta(tagPrefix)
// Match tagPrefix followed by word characters
pattern := escapedPrefix + `\w+`
re := regexp.MustCompile(pattern)
// parseTags extracts tags from markdown content using + prefix
func parseTags(content string) []string {
// Match + followed by word characters
re := regexp.MustCompile(`\+\w+`)
matches := re.FindAllString(content, -1)