From 302aa7084b7ef1e7167b3d611584d3d824663913 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 16 Mar 2015 11:25:11 -0700 Subject: [PATCH] Call don't interfere with config.json updates while calling only --completion --- cmd-config.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cmd-config.go b/cmd-config.go index 952f390c..4c09a11d 100644 --- a/cmd-config.go +++ b/cmd-config.go @@ -87,13 +87,10 @@ func parseConfigInput(c *cli.Context) (config *mcConfig, err error) { }, }, } - if c.Bool("completion") { - getBashCompletion() - } return config, nil } -func doConfig(c *cli.Context) { +func getConfig(c *cli.Context) { configData, err := parseConfigInput(c) if err != nil { fatal(err.Error()) @@ -119,6 +116,15 @@ func doConfig(c *cli.Context) { if err != nil { fatal(err.Error()) } - msg := "\nConfiguration written to " + getMcConfigFilename() + msg := "\nConfiguration written to " + getMcConfigFilename() + "\n" info(msg) } + +func doConfig(c *cli.Context) { + switch true { + case c.Bool("completion") == true: + getBashCompletion() + case c.Bool("completion") == false: + getConfig(c) + } +}