~samwhited/blogsync

ref: c7d923e270765e9f5973f8ff39e10d4e218d3cb0 blogsync/collection.go -rw-r--r-- 688 bytes
c7d923e2Sam Whited blogsync: fix name of convert command flagset 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2019 The Blog Sync Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.

package main

import (
	"fmt"
	"log"

	"github.com/writeas/go-writeas/v2"
	"mellium.im/cli"
)

func collectionsCmd(client *writeas.Client, logger, debug *log.Logger) *cli.Command {
	return &cli.Command{
		Usage:       "collections",
		Description: `List collections owned by the authenticated user.`,
		Run: func(cmd *cli.Command, args ...string) error {
			colls, err := client.GetUserCollections()
			if err != nil {
				return err
			}

			for _, coll := range *colls {
				fmt.Printf("%+v\n", coll)
			}
			return nil
		},
	}
}