~gjabell/bmk

d4492c7981137adeb1f2c2fd6d51938bea3b912e — Galen Abell 5 years ago 268f602
Lowercase and sort tags before adding
1 files changed, 6 insertions(+), 0 deletions(-)

M bookmark/bookmark.go
M bookmark/bookmark.go => bookmark/bookmark.go +6 -0
@@ 19,6 19,7 @@ import (
	"fmt"
	"io/ioutil"
	"os"
	"sort"
	"strconv"
	"strings"



@@ 58,6 59,11 @@ func Add(filename string, bookmark Bookmark) error {
		return err
	}

	// normalize tags
	for i, t := range bookmark.Tags {
		bookmark.Tags[i] = strings.ToLower(t)
	}
	sort.Strings(bookmark.Tags)
	lst = append(lst, bookmark)

	return save(filename, lst)