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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user