add instance_activity/instance_peers command
This commit is contained in:
parent
84ffd85539
commit
0022a53649
24
cmd/mstdn/cmd_instance_activity.go
Normal file
24
cmd/mstdn/cmd_instance_activity.go
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/mattn/go-mastodon"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
func cmdInstanceActivity(c *cli.Context) error {
|
||||||
|
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||||
|
activities, err := client.GetInstanceActivity(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, activity := range activities {
|
||||||
|
fmt.Fprintf(c.App.Writer, "Logins : %v\n", activity.Logins)
|
||||||
|
fmt.Fprintf(c.App.Writer, "Registrations : %v\n", activity.Registrations)
|
||||||
|
fmt.Fprintf(c.App.Writer, "Statuses : %v\n", activity.Statuses)
|
||||||
|
fmt.Fprintf(c.App.Writer, "EMail : %v\n", activity.Week)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
21
cmd/mstdn/cmd_instance_peers.go
Normal file
21
cmd/mstdn/cmd_instance_peers.go
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/mattn/go-mastodon"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
func cmdInstancePeers(c *cli.Context) error {
|
||||||
|
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||||
|
peers, err := client.GetInstancePeers(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, peer := range peers {
|
||||||
|
fmt.Fprintln(c.App.Writer, peer)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -245,6 +245,16 @@ func makeApp() *cli.App {
|
||||||
Usage: "show instance information",
|
Usage: "show instance information",
|
||||||
Action: cmdInstance,
|
Action: cmdInstance,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "instance_activity",
|
||||||
|
Usage: "show instance activity information",
|
||||||
|
Action: cmdInstanceActivity,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "instance_peers",
|
||||||
|
Usage: "show instance peers information",
|
||||||
|
Action: cmdInstancePeers,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "account",
|
Name: "account",
|
||||||
Usage: "show account information",
|
Usage: "show account information",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user