# HG changeset patch # User Ollivier Robert # Date 1491834087 -7200 # Node ID 8343e5264a9b44f4e5aa700f6b7ff9c124f1ff11 # Parent a0d3e7265cd23a031dd3cf619a8e9ed93faca8ba Hook up the application registration + gofmt. diff -r a0d3e7265cd2 -r 8343e5264a9b cmd/gondole/main.go --- 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 " - 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 " + 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) }