~nature/yt-cli

ea8e7f52e1adba53b4bd57ac53033b1be4b654f3 — LordNature 1 year, 5 months ago bf35500
main.go: Converted to table and removed channels var.
1 files changed, 6 insertions(+), 7 deletions(-)

M main.go
M main.go => main.go +6 -7
@@ 11,6 11,7 @@ import (
	"io/ioutil"
	"fmt"
	"strings"
	"text/tabwriter"
)

type Channel struct {


@@ 78,9 79,6 @@ func main() {
		return
	}


	var channels []Channel

	if *add != "" && *list == true {
		log.Fatal("only one operation may be used at a time")
		return


@@ 97,6 95,9 @@ func main() {
	// List all channels' videos to stdout
	if *list == true {
		subs, _ := readSubs()
		// minwidth, tabwidth, padding, padchar, flags
		w := new(tabwriter.Writer)
		w.Init(os.Stdout, 5, 0, 1, ' ', 0)
		for _, k := range subs {
			ch, err := getVideos(k)
			if err != nil {


@@ 104,12 105,11 @@ func main() {
			}
			for i, v := range ch.Videos {
				if i > 4 { break }
				fmt.Printf("[%.10s] %.20s - %.50s\n", v.Date, ch.Name, v.Title)
				fmt.Fprintf(w, "[%.10s]\t%.20s\t- %.50s\t(%.12s)\n", v.Date, ch.Name, v.Title, v.ID)
			}
		}
		w.Flush()
	}

	// Get videoID from formatted title
}

// Appends subscription to file


@@ 161,7 161,6 @@ func getVideos(chID string) (ch Channel, err error) {
	return
}


func listVideos(chs []Channel) (vid string, err error) {
	var input string
	for _, c := range chs {