bookends

commit 20295232be1fd927ff53a953fb1792432560a36c

Author: Honza Pokorny <honza@redhat.com>

Remove yaml code

 cmd/root.go | 1 
 cmd/yaml2org.go | 19 -----------
 go.mod | 1 
 go.sum | 5 ---
 pkg/bookends/bookends.go | 70 ++++-------------------------------------


diff --git a/cmd/root.go b/cmd/root.go
index 91a16ece31fe71f022ea15cfcdf4a4787f7fa80e..3827dad07700580511a43fa67e5c9a05419dea39 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -51,7 +51,6 @@ 	rootCmd.PersistentFlags().StringVar(&coversDir, "covers-dir", "covers", "")
 	rootCmd.PersistentFlags().StringVar(&outputFilename, "output-filename", "output.html", "")
 
 	rootCmd.AddCommand(buildCmd)
-	rootCmd.AddCommand(yaml2OrgCmd)
 	rootCmd.AddCommand(cacheCovers)
 	// rootCmd.AddCommand(versionCmd)
 }




diff --git a/cmd/yaml2org.go b/cmd/yaml2org.go
deleted file mode 100644
index 396bbda60ef64c142a3eca3b963d8d399930f0ca..0000000000000000000000000000000000000000
--- a/cmd/yaml2org.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package cmd
-
-import (
-	"fmt"
-
-	"git.pokorny.ca/bookends/pkg/bookends"
-	"github.com/spf13/cobra"
-)
-
-var yaml2OrgCmd = &cobra.Command{
-	Use:   "yaml2org",
-	Short: "",
-	Run: func(cmd *cobra.Command, args []string) {
-		err := bookends.Yaml2Org()
-		if err != nil {
-			fmt.Println(err)
-		}
-	},
-}




diff --git a/go.mod b/go.mod
index f9195ccb5e52a0729c67e2c9ba64957c02d901eb..d7bc339e491f484f85a36695cef09e24e02479ce 100644
--- a/go.mod
+++ b/go.mod
@@ -5,5 +5,4 @@
 require (
 	github.com/niklasfasching/go-org v1.5.0
 	github.com/spf13/cobra v1.1.3
-	gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
 )




diff --git a/go.sum b/go.sum
index a799ca1dc78caf93fc0d337b7e3690ea9a4d00b9..1b548be0cd60a2de297fb748166b6e2568d0c3f1 100644
--- a/go.sum
+++ b/go.sum
@@ -106,10 +106,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
-github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
-github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
 github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
@@ -295,7 +293,6 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
 google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
 gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
@@ -304,8 +301,6 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
 gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
-gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
-gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=




diff --git a/pkg/bookends/bookends.go b/pkg/bookends/bookends.go
index 7fef50b2a9ec713b46fe8ca240867655f6a463ec..d0e091629d732b7109cea90ddb915c3adf1efdc3 100644
--- a/pkg/bookends/bookends.go
+++ b/pkg/bookends/bookends.go
@@ -6,7 +6,6 @@ 	"errors"
 	"fmt"
 	"html/template"
 	"io"
-	"io/ioutil"
 	"net/http"
 	"net/url"
 	"os"
@@ -17,7 +16,6 @@ 	"strings"
 	"time"
 
 	"github.com/niklasfasching/go-org/org"
-	"gopkg.in/yaml.v3"
 )
 
 type Config struct {
@@ -29,32 +27,16 @@ }
 
 type DateRead struct {
 	time.Time
-}
-
-func (t *DateRead) UnmarshalYAML(unmarshal func(interface{}) error) error {
-	var tm string
-	if err := unmarshal(&tm); err != nil {
-		return err
-	}
-
-	dr, err := time.Parse("2006-01-02", tm)
-	if err != nil {
-		return err
-	}
-
-	*t = DateRead{dr}
-
-	return nil
 }
 
 type Book struct {
-	Author   string        `yaml:"author"`
-	Title    string        `yaml:"title"`
-	ISBN     string        `yaml:"isbn"`
-	DateRead DateRead      `yaml:"date_read"`
-	Rating   int           `yaml:"rating"`
-	Review   template.HTML `yaml:"review"`
-	Tags     []string      `yaml:"tags"`
+	Author   string
+	Title    string
+	ISBN     string
+	DateRead DateRead
+	Rating   int
+	Review   template.HTML
+	Tags     []string
 }
 
 type BooksByDateRead []Book
@@ -155,8 +137,6 @@
 	if err != nil {
 		return err
 	}
-
-	// 	fmt.Println(htmlOutput)
 
 	err = WriteFile(config.OutputFilename, htmlOutput)
 
@@ -283,42 +263,6 @@ 	}
 
 	return books, nil
 
-}
-
-func Yaml2Org() error {
-	contents, err := ioutil.ReadFile("books.yaml")
-	if err != nil {
-		return err
-	}
-
-	var books []Book
-	yaml.Unmarshal(contents, &books)
-	if err != nil {
-		return err
-	}
-
-	fmt.Println(books)
-	sort.Sort(BooksByDateRead(books))
-
-	year := 2021
-	fmt.Println("* 2021")
-
-	for _, book := range books {
-		if book.DateRead.Year() != year {
-			fmt.Println("*", book.DateRead.Year())
-			year = book.DateRead.Year()
-		}
-		fmt.Println("** DONE", book.Title)
-		fmt.Printf("CLOSED: [%s]\n", book.DateRead.Format("2006-01-02 Mon 15:04"))
-		fmt.Println(":PROPERTIES:")
-		fmt.Printf(":author: %s\n", book.Author)
-		fmt.Printf(":rating: %d\n", book.Rating)
-		fmt.Printf(":isbn: %s\n", book.ISBN)
-		fmt.Println(":END:")
-		fmt.Println("")
-	}
-
-	return nil
 }
 
 func copy(src, dst string) error {