Merge pull request #703 from harshavardhana/pr_out_minor_changes_to_command_templates

master
Harshavardhana 9 years ago
commit 18a8891a15
  1. 17
      commands.go

@ -10,7 +10,7 @@ import (
var commands = []cli.Command{ var commands = []cli.Command{
serverCmd, serverCmd,
controlCmd, controllerCmd,
} }
var serverCmd = cli.Command{ var serverCmd = cli.Command{
@ -25,13 +25,13 @@ USAGE:
EXAMPLES: EXAMPLES:
1. Start in server mode 1. Start in server mode
$ minio server $ minio {{.Name}}
`, `,
} }
var controlCmd = cli.Command{ var controllerCmd = cli.Command{
Name: "control", Name: "controller",
Description: "Control mode", Description: "Control mode",
Action: runController, Action: runController,
CustomHelpTemplate: `NAME: CustomHelpTemplate: `NAME:
@ -42,12 +42,12 @@ USAGE:
EXAMPLES: EXAMPLES:
1. Start in controller mode 1. Start in controller mode
$ minio control $ minio {{.Name}}
`, `,
} }
func getAPIServerConfig(c *cli.Context) api.Config { func getServerConfig(c *cli.Context) api.Config {
certFile := c.GlobalString("cert") certFile := c.GlobalString("cert")
keyFile := c.GlobalString("key") keyFile := c.GlobalString("key")
if (certFile != "" && keyFile == "") || (certFile == "" && keyFile != "") { if (certFile != "" && keyFile == "") || (certFile == "" && keyFile != "") {
@ -68,7 +68,7 @@ func runServer(c *cli.Context) {
if err != nil { if err != nil {
Fatalf("Unable to determine current user. Reason: %s\n", err) Fatalf("Unable to determine current user. Reason: %s\n", err)
} }
apiServerConfig := getAPIServerConfig(c) apiServerConfig := getServerConfig(c)
if err := server.StartServices(apiServerConfig); err != nil { if err := server.StartServices(apiServerConfig); err != nil {
Fatalln(err) Fatalln(err)
} }
@ -79,7 +79,4 @@ func runController(c *cli.Context) {
if err != nil { if err != nil {
Fatalf("Unable to determine current user. Reason: %s\n", err) Fatalf("Unable to determine current user. Reason: %s\n", err)
} }
if len(c.Args()) < 1 {
cli.ShowCommandHelpAndExit(c, "control", 1) // last argument is exit code
}
} }

Loading…
Cancel
Save