ignore boosts option for timline command
This commit is contained in:
parent
619addcc28
commit
9d955119f2
2
go.mod
2
go.mod
|
@ -3,6 +3,6 @@ module git.gutmet.org/swill.git
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.gutmet.org/go-mastodon.git v0.0.0-20221121192555-9585b1ce2e3b
|
git.gutmet.org/go-mastodon.git v0.0.0-20221123195156-1cc330baf3e9
|
||||||
git.gutmet.org/goutil.git v0.0.0-20201108182825-c19893df11f9
|
git.gutmet.org/goutil.git v0.0.0-20201108182825-c19893df11f9
|
||||||
)
|
)
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,5 +1,5 @@
|
||||||
git.gutmet.org/go-mastodon.git v0.0.0-20221121192555-9585b1ce2e3b h1:hrafneYyLpduomEizAU5FmfVCdwNz077iXm6h9IkQBM=
|
git.gutmet.org/go-mastodon.git v0.0.0-20221123195156-1cc330baf3e9 h1:Jnyy69NDSxIBdfSnUExm89WpQhpUy1V584mr2DPsvNY=
|
||||||
git.gutmet.org/go-mastodon.git v0.0.0-20221121192555-9585b1ce2e3b/go.mod h1:e/Z3dytr4MYC4rdOjbWEbWXS+zy1CWxjvplVGTE/eH8=
|
git.gutmet.org/go-mastodon.git v0.0.0-20221123195156-1cc330baf3e9/go.mod h1:e/Z3dytr4MYC4rdOjbWEbWXS+zy1CWxjvplVGTE/eH8=
|
||||||
git.gutmet.org/goutil.git v0.0.0-20201108182825-c19893df11f9 h1:XVD037Slgdl/CxcCWVtN6V+LzYl6QrTQ0upVIVpy6VE=
|
git.gutmet.org/goutil.git v0.0.0-20201108182825-c19893df11f9 h1:XVD037Slgdl/CxcCWVtN6V+LzYl6QrTQ0upVIVpy6VE=
|
||||||
git.gutmet.org/goutil.git v0.0.0-20201108182825-c19893df11f9/go.mod h1:iMgpxo9FxmbnUiQu5ugpjdtVZmh2rA9nySCr/GHkA64=
|
git.gutmet.org/goutil.git v0.0.0-20201108182825-c19893df11f9/go.mod h1:iMgpxo9FxmbnUiQu5ugpjdtVZmh2rA9nySCr/GHkA64=
|
||||||
git.gutmet.org/linkheader.git v0.0.0-20221120205136-a51e89fd8486 h1:7F1dwJvIgvHNvglosyIE7SA49BwG6b8DFkvD8NtHMD8=
|
git.gutmet.org/linkheader.git v0.0.0-20221120205136-a51e89fd8486 h1:7F1dwJvIgvHNvglosyIE7SA49BwG6b8DFkvD8NtHMD8=
|
||||||
|
|
18
swill.go
18
swill.go
|
@ -279,17 +279,29 @@ func statusCommand() (goutil.CommandFlagsInit, goutil.CommandFunc) {
|
||||||
return flagsInit, func(args []string) error { return status(f, args) }
|
return flagsInit, func(args []string) error { return status(f, args) }
|
||||||
}
|
}
|
||||||
|
|
||||||
func userTimeline(args []string) error {
|
type timelineFlags struct {
|
||||||
|
ignoreBoosts bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func userTimeline(f timelineFlags, args []string) error {
|
||||||
checkUsage(args, 1, 1, "timeline USER")
|
checkUsage(args, 1, 1, "timeline USER")
|
||||||
user := args[0]
|
user := args[0]
|
||||||
account, err := mastodon.LookupAccount(user)
|
account, err := mastodon.LookupAccount(user)
|
||||||
optLogFatal("userTimeline - lookup account", err)
|
optLogFatal("userTimeline - lookup account", err)
|
||||||
statuses, err := account.GetStatuses(nil)
|
statuses, err := account.GetStatuses(f.ignoreBoosts, nil)
|
||||||
optLogFatal("userTimeline - get statuses", err)
|
optLogFatal("userTimeline - get statuses", err)
|
||||||
PrintStatuses(statuses)
|
PrintStatuses(statuses)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func userTimelineCommand() (goutil.CommandFlagsInit, goutil.CommandFunc) {
|
||||||
|
f := timelineFlags{}
|
||||||
|
flagsInit := func(s *flag.FlagSet) {
|
||||||
|
s.BoolVar(&f.ignoreBoosts, "ignore-boosts", false, "")
|
||||||
|
}
|
||||||
|
return flagsInit, func(args []string) error { return userTimeline(f, args) }
|
||||||
|
}
|
||||||
|
|
||||||
type generalFlags struct {
|
type generalFlags struct {
|
||||||
templateFile string
|
templateFile string
|
||||||
}
|
}
|
||||||
|
@ -329,7 +341,7 @@ func main() {
|
||||||
initializeMastodon()
|
initializeMastodon()
|
||||||
commands := []goutil.Command{
|
commands := []goutil.Command{
|
||||||
goutil.NewCommandWithFlags("status", wrapCommandFl(statusCommand), "post a status with message and/or media"),
|
goutil.NewCommandWithFlags("status", wrapCommandFl(statusCommand), "post a status with message and/or media"),
|
||||||
goutil.NewCommandWithFlags("timeline", wrapCommand(userTimeline), "get timeline of a specific user"),
|
goutil.NewCommandWithFlags("timeline", wrapCommandFl(userTimelineCommand), "get latest timeline of a specific user"),
|
||||||
}
|
}
|
||||||
_ = goutil.Execute(commands)
|
_ = goutil.Execute(commands)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user