@@ 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")
}