func (b *Bookmarks) AddBookmark(m Bookmark) {
	b.Bookmark = append(b.Bookmark, m)
}
AddBookmark adds a new bookmarks
package ham
import (
	"fmt"
	"io"
	"os"
	"time"
	"github.com/BurntSushi/toml"
	"github.com/dh1tw/goHamlib"
)
type Bookmarks struct {
	Bookmark []Bookmark
	Filename string `toml:"-"`
}
type BookmarkMode goHamlib.Mode
func (b BookmarkMode) MarshalText() (text []byte, err error) {
	s := goHamlib.ModeName[goHamlib.Mode(b)]
	if s == "" {
		return nil, fmt.Errorf("unknown mode: %d", b)
	}
	return []byte(s), nil
}
func (b *BookmarkMode) UnmarshalText(text []byte) error {
	v, ok := goHamlib.ModeValue[string(text)]
	if !ok {
		return fmt.Errorf("unknown mode %s", string(text))
	}
	*b = BookmarkMode(v)
	return nil
}
type Bookmark struct {
	Frequency float64
	Mode      BookmarkMode
	Created   time.Time
	Notes     string
	Width     int
}
func OpenBookmarks(filename string) (*Bookmarks, error) {
	bm := &Bookmarks{}
	_, err := toml.DecodeFile(filename, &bm)
	if err != nil {
		return nil, err
	}
	bm.Filename = filename
	return bm, nil
}
func (b *Bookmarks) Save() error {
	return b.WriteToFile(b.Filename)
}
func (b *Bookmarks) WriteToFile(path string) error {
	f, err := os.Create(path)
	if err != nil {
		return err
	}
	defer f.Close()
	return b.Write(f)
}
func (b *Bookmarks) Write(w io.Writer) error {
	enc := toml.NewEncoder(w)
	return enc.Encode(b)
}