go-mastodon/cmd/mstdn/cmd_instance.go

23 lines
564 B
Go
Raw Normal View History

2017-04-15 15:25:20 +02:00
package main
import (
"context"
2017-04-15 15:25:20 +02:00
"fmt"
"github.com/mattn/go-mastodon"
"github.com/urfave/cli"
)
func cmdInstance(c *cli.Context) error {
client := c.App.Metadata["client"].(*mastodon.Client)
instance, err := client.GetInstance(context.Background())
2017-04-15 15:25:20 +02:00
if err != nil {
return err
}
2017-04-16 15:27:13 +02:00
fmt.Fprintf(c.App.Writer, "URI : %s\n", instance.URI)
fmt.Fprintf(c.App.Writer, "Title : %s\n", instance.Title)
fmt.Fprintf(c.App.Writer, "Description: %s\n", instance.Description)
fmt.Fprintf(c.App.Writer, "EMail : %s\n", instance.EMail)
2017-04-15 15:25:20 +02:00
return nil
}