summaryrefslogtreecommitdiff
path: root/links.go
blob: bd7b62412786a415b32c786c9a7564e9aa47a341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"errors"
	"html/template"
)

type Link struct {
	Title string
	URL   template.URL
}

var links = []Link{}

func addLinkCmd(params []string) error {
	if len(params) != 2 {
		return errors.New("add-link needs 2 parameters: title url")
	}

	links = append(links, Link{params[0], template.URL(params[1])})
	return nil
}