From b6044120efff4f67dda06e4c3c96b7bb5d6287d5 Mon Sep 17 00:00:00 2001 From: Matti R Date: Mon, 2 Mar 2020 13:59:32 -0500 Subject: [PATCH] go fmt & update per feedback --- cmd/writefreely/config.go | 16 +++++++--------- cmd/writefreely/db.go | 12 ++++++------ cmd/writefreely/keys.go | 5 ++--- cmd/writefreely/main.go | 3 +++ cmd/writefreely/user.go | 4 ++-- cmd/writefreely/web.go | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cmd/writefreely/config.go b/cmd/writefreely/config.go index d572036..c5ff455 100644 --- a/cmd/writefreely/config.go +++ b/cmd/writefreely/config.go @@ -30,25 +30,23 @@ var ( Name: "generate", Aliases: []string{"gen"}, Usage: "Generate a basic configuration", - Action: genConfigAction, + Action: genConfigAction, } cmdConfigInteractive cli.Command = cli.Command{ - Name: "interactive", - Aliases: []string{"i"}, - Usage: "Interactive configuration process", + Name: "start", + Usage: "Interactive configuration process", Action: interactiveConfigAction, Flags: []cli.Flag{ &cli.StringFlag{ Name: "sections", Value: "server db app", - Usage: "Which sections of the configuration to go through (requires --config)\n" + - "valid values are any combination of 'server', 'db' and 'app' \n" + - "example: writefreely --config --sections \"db app\"", + Usage: "Which sections of the configuration to go through\n" + + "valid values of sections flag are any combination of 'server', 'db' and 'app' \n" + + "example: writefreely config start --sections \"db app\"", }, }, } - ) func genConfigAction(c *cli.Context) error { @@ -60,4 +58,4 @@ func interactiveConfigAction(c *cli.Context) error { app := writefreely.NewApp(c.String("c")) writefreely.DoConfig(app, c.String("sections")) return nil -} \ No newline at end of file +} diff --git a/cmd/writefreely/db.go b/cmd/writefreely/db.go index fa5110d..badc805 100644 --- a/cmd/writefreely/db.go +++ b/cmd/writefreely/db.go @@ -27,15 +27,15 @@ var ( } cmdDBInit cli.Command = cli.Command{ - Name: "init", - Usage: "Initialize Database", + Name: "init", + Usage: "Initialize Database", Action: initDBAction, } cmdDBMigrate cli.Command = cli.Command{ - Name: "migrate", - Usage: "Migrate Database", - Action: migrateDBAction, + Name: "migrate", + Usage: "Migrate Database", + Action: migrateDBAction, } ) @@ -47,4 +47,4 @@ func initDBAction(c *cli.Context) error { func migrateDBAction(c *cli.Context) error { app := writefreely.NewApp(c.String("c")) return writefreely.Migrate(app) -} \ No newline at end of file +} diff --git a/cmd/writefreely/keys.go b/cmd/writefreely/keys.go index 7e81475..9028f51 100644 --- a/cmd/writefreely/keys.go +++ b/cmd/writefreely/keys.go @@ -29,12 +29,11 @@ var ( Name: "generate", Aliases: []string{"gen"}, Usage: "Generate encryption and authentication keys", - Action: genKeysAction, + Action: genKeysAction, } - ) func genKeysAction(c *cli.Context) error { app := writefreely.NewApp(c.String("c")) return writefreely.GenerateKeyFiles(app) -} \ No newline at end of file +} diff --git a/cmd/writefreely/main.go b/cmd/writefreely/main.go index 55f97be..45dfb80 100644 --- a/cmd/writefreely/main.go +++ b/cmd/writefreely/main.go @@ -23,6 +23,9 @@ import ( ) func main() { + cli.VersionPrinter = func(c *cli.Context) { + fmt.Printf("%s\n", c.App.Version) + } app := &cli.App{ Name: "WriteFreely", Usage: "A beautifully pared-down blogging platform", diff --git a/cmd/writefreely/user.go b/cmd/writefreely/user.go index c87129a..f6bdd84 100644 --- a/cmd/writefreely/user.go +++ b/cmd/writefreely/user.go @@ -29,9 +29,9 @@ var ( } cmdAddUser cli.Command = cli.Command{ - Name: "add", + Name: "create", Usage: "Add new user", - Aliases: []string{"a"}, + Aliases: []string{"a", "add"}, Flags: []cli.Flag{ &cli.BoolFlag{ Name: "admin", diff --git a/cmd/writefreely/web.go b/cmd/writefreely/web.go index e848f8b..a687548 100644 --- a/cmd/writefreely/web.go +++ b/cmd/writefreely/web.go @@ -20,10 +20,10 @@ import ( var ( cmdServe cli.Command = cli.Command{ - Name: "serve", + Name: "serve", Aliases: []string{"web"}, - Usage: "Run web application", - Action: serveAction, + Usage: "Run web application", + Action: serveAction, } ) @@ -46,4 +46,4 @@ func serveAction(c *cli.Context) error { writefreely.Serve(app, r) return nil -} \ No newline at end of file +}