20 sinceID, maxID int64 |
20 sinceID, maxID int64 |
21 } |
21 } |
22 |
22 |
23 // timelineCmd represents the timelines command |
23 // timelineCmd represents the timelines command |
24 var timelineCmd = &cobra.Command{ |
24 var timelineCmd = &cobra.Command{ |
25 Use: "timeline [home|public|:HASHTAG|!list_id] [--local]", |
25 Use: "timeline [home|public|direct|:HASHTAG|!list_id] [--local]", |
26 Aliases: []string{"tl"}, |
26 Aliases: []string{"tl"}, |
27 Short: "Fetch a timeline", |
27 Short: "Fetch a timeline", |
28 Long: ` |
28 Long: ` |
29 The timeline command fetches a timeline (home, local or federated). |
29 The timeline command fetches a timeline (home, local or federated). |
|
30 The timeline "direct" contains only direct messages (that is, messages with |
|
31 visibility set to "direct"). |
30 It can also get a hashtag-based timeline if the keyword or prefixed with |
32 It can also get a hashtag-based timeline if the keyword or prefixed with |
31 ':' or '#', or a list-based timeline (use !ID with the list ID).`, |
33 ':' or '#', or a list-based timeline (use !ID with the list ID).`, |
32 Example: ` madonctl timeline |
34 Example: ` madonctl timeline |
33 madonctl timeline public --local |
35 madonctl timeline public --local |
34 madonctl timeline '!42' |
36 madonctl timeline '!42' |
35 madonctl timeline :mastodon`, |
37 madonctl timeline :mastodon |
|
38 madonctl timeline direct`, |
36 RunE: timelineRunE, |
39 RunE: timelineRunE, |
37 ValidArgs: []string{"home", "public"}, |
40 ValidArgs: []string{"home", "public", "direct"}, |
38 } |
41 } |
39 |
42 |
40 func init() { |
43 func init() { |
41 RootCmd.AddCommand(timelineCmd) |
44 RootCmd.AddCommand(timelineCmd) |
42 |
45 |
70 if len(args) > 0 { |
73 if len(args) > 0 { |
71 tl = args[0] |
74 tl = args[0] |
72 } |
75 } |
73 |
76 |
74 // Home timeline and list-based timeline require to be logged in |
77 // Home timeline and list-based timeline require to be logged in |
75 if err := madonInit(tl == "home" || strings.HasPrefix(tl, "!")); err != nil { |
78 if err := madonInit(tl == "home" || tl == "direct" || strings.HasPrefix(tl, "!")); err != nil { |
76 return err |
79 return err |
77 } |
80 } |
78 |
81 |
79 sl, err := gClient.GetTimelines(tl, opt.local, opt.onlyMedia, limOpts) |
82 sl, err := gClient.GetTimelines(tl, opt.local, opt.onlyMedia, limOpts) |
80 if err != nil { |
83 if err != nil { |