~gjabell/bmk

bf7f8fb53282c9dd96ab66244b9b3b24fe5614f4 — Galen Abell 1 year, 4 months ago 439595b
Add plain option to disable printing the table
1 files changed, 11 insertions(+), 1 deletions(-)

M cmd/list.go
M cmd/list.go => cmd/list.go +11 -1
@@ 16,12 16,15 @@
package cmd

import (
	"fmt"
	"strings"

	"git.sr.ht/~gjabell/bmk/bookmark"
	"github.com/spf13/cobra"
)

var plain bool

var listCmd = &cobra.Command{
	Use:     "list",
	Aliases: []string{"l", "ls"},


@@ 35,7 38,13 @@ description. Bookmarks will be filtered by the tags and/or description.`,
			return err
		}

		bookmark.Print(bookmarks)
		if !plain {
			bookmark.Print(bookmarks)
		} else {
			for _, b := range bookmarks {
				fmt.Println(b.URL)
			}
		}

		return nil
	},


@@ 45,4 54,5 @@ func init() {
	rootCmd.AddCommand(listCmd)

	listCmd.Flags().StringArrayVarP(&tags, "tag", "t", nil, "list bookmarks matching the tag")
	listCmd.Flags().BoolVarP(&plain, "plain", "p", false, "print a list of URLs instead of a table")
}