diff --git a/api_pinboard.go b/api_pinboard.go index 00146d2..4582a5f 100644 --- a/api_pinboard.go +++ b/api_pinboard.go @@ -23,7 +23,7 @@ func postToCloud(args string, ga *Alfred.GoAlfred) (info []string, err error) { return pinInfo, errors.New("Set your authorization token first!") } var payload pinboardPayload - payload.tags, payload.extended = parseTags(args) + payload.tags, payload.extended, payload.toread = parseTags(args) payload.url = pinInfo[0] payload.description = pinInfo[1] payload.replace = "yes" diff --git a/go-pinboard.go b/go-pinboard.go index 858320a..dd585c4 100644 --- a/go-pinboard.go +++ b/go-pinboard.go @@ -33,6 +33,7 @@ type pinboardPayload struct { tags string replace string shared string + toread string auth_token string } @@ -278,6 +279,7 @@ func encodeURL(payload pinboardPayload, pathURL string) (req url.URL) { q.Set("shared", payload.shared) q.Set("tags", payload.tags) q.Set("auth_token", payload.auth_token) + q.Set("toread", payload.toread) u.RawQuery = q.Encode() return u } diff --git a/tags_pinboard.go b/tags_pinboard.go index 24e0839..eaae7f0 100644 --- a/tags_pinboard.go +++ b/tags_pinboard.go @@ -155,12 +155,20 @@ func getTagsFor(q string, ga *Alfred.GoAlfred) (m sortedTags, err error) { return m, nil } -func parseTags(args string) (tags, desc string) { +func parseTags(args string) (tags, desc string, toread string) { foo_ := strings.Split(args, commentCharacter) tags = strings.Trim(foo_[0], " ") desc = "" + toread = "no" if len(foo_) > 1 { desc = strings.Trim(foo_[1], " ") + desc_words := strings.Split(desc, " ") + for _, word := range desc_words { + if word == "toread" { + toread = "yes" + break + } + } } - return tags, desc + return tags, desc, toread }