Add option --only-media to madonctl timelines (Mastodon 2.3.0+)
authorMikael Berthe <mikael@lilotux.net>
Tue, 20 Mar 2018 19:22:14 +0100
changeset 200 488f5fc5be98
parent 199 2818e6882c1b
child 201 5cb568653fc7
Add option --only-media to madonctl timelines (Mastodon 2.3.0+)
cmd/timelines.go
--- a/cmd/timelines.go	Tue Mar 20 19:03:54 2018 +0100
+++ b/cmd/timelines.go	Tue Mar 20 19:22:14 2018 +0100
@@ -15,9 +15,9 @@
 )
 
 var timelineOpts struct {
-	local          bool
-	limit, keep    uint
-	sinceID, maxID int64
+	local, onlyMedia bool
+	limit, keep      uint
+	sinceID, maxID   int64
 }
 
 // timelineCmd represents the timelines command
@@ -41,6 +41,7 @@
 	RootCmd.AddCommand(timelineCmd)
 
 	timelineCmd.Flags().BoolVar(&timelineOpts.local, "local", false, "Posts from the local instance")
+	timelineCmd.Flags().BoolVar(&timelineOpts.onlyMedia, "only-media", false, "Only statuses with media attachments")
 	timelineCmd.Flags().UintVarP(&timelineOpts.limit, "limit", "l", 0, "Limit number of API results")
 	timelineCmd.Flags().UintVarP(&timelineOpts.keep, "keep", "k", 0, "Limit number of results")
 	timelineCmd.PersistentFlags().Int64Var(&timelineOpts.sinceID, "since-id", 0, "Request IDs greater than a value")
@@ -75,7 +76,7 @@
 		return err
 	}
 
-	sl, err := gClient.GetTimelines(tl, opt.local, limOpts)
+	sl, err := gClient.GetTimelines(tl, opt.local, opt.onlyMedia, limOpts)
 	if err != nil {
 		errPrint("Error: %s", err.Error())
 		os.Exit(1)