add instance command
parent
f4bf175883
commit
76d34e4b04
|
@ -0,0 +1,21 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"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()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Printf("URI : %s\n", instance.URI)
|
||||||
|
fmt.Printf("Title : %s\n", instance.Title)
|
||||||
|
fmt.Printf("Description: %s\n", instance.Description)
|
||||||
|
fmt.Printf("EMail : %s\n", instance.EMail)
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -197,6 +197,11 @@ func run() int {
|
||||||
Usage: "show notification",
|
Usage: "show notification",
|
||||||
Action: cmdNotification,
|
Action: cmdNotification,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "instance",
|
||||||
|
Usage: "show instance information",
|
||||||
|
Action: cmdInstance,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
app.Run(os.Args)
|
app.Run(os.Args)
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue