Hook up the application registration + gofmt.
--- a/cmd/gondole/main.go Mon Apr 10 16:20:38 2017 +0200
+++ b/cmd/gondole/main.go Mon Apr 10 16:21:27 2017 +0200
@@ -1,45 +1,49 @@
package main
import (
- "log"
- "github.com/keltia/gondole"
- "github.com/urfave/cli"
- "os"
+ "github.com/keltia/gondole"
+ "github.com/urfave/cli"
+ "log"
+ "os"
)
var (
- fVerbose bool
+ fVerbose bool
+ instance *gondole.Gondole
+ cnf *gondole.Config
)
-func Register(c *cli.Context) error {
+func Register(c *cli.Context) (err error) {
- return nil
+ instance, err = gondole.NewApp("gondole-cli", nil, gondole.NoRedirect)
+ return err
}
func init() {
- cli.VersionFlag = cli.BoolFlag{Name: "version, V"}
+ cli.VersionFlag = cli.BoolFlag{Name: "version, V"}
- cli.VersionPrinter = func(c *cli.Context) {
- log.Printf("API wrapper: %s Mastodon CLI: %s\n", c.App.Version, gondole.APIVersion)
- }
+ cli.VersionPrinter = func(c *cli.Context) {
+ log.Printf("API wrapper: %s Mastodon CLI: %s\n", c.App.Version, gondole.APIVersion)
+ }
}
func main() {
- app := cli.NewApp()
- app.Name = "gondole"
- app.Usage = "Mastodon CLI interface"
- app.Author = "Ollivier Robert <roberto@keltia.net>"
- app.Version = gondole.APIVersion
- //app.HideVersion = true
- app.Before = Register
+ app := cli.NewApp()
+ app.Name = "gondole"
+ app.Usage = "Mastodon CLI interface"
+ app.Author = "Ollivier Robert <roberto@keltia.net>"
+ app.Version = gondole.APIVersion
+ //app.HideVersion = true
+
+ app.Before = Register
- app.Flags = []cli.Flag{
- cli.BoolFlag{
- Name: "verbose,v",
- Usage: "verbose mode",
- Destination: &fVerbose,
- },
- }
- app.Run(os.Args)
+ app.Flags = []cli.Flag{
+ cli.BoolFlag{
+ Name: "verbose,v",
+ Usage: "verbose mode",
+ Destination: &fVerbose,
+ },
+ }
+ app.Run(os.Args)
}