From 5288f0fffa10f0eb28b0ea3ee9cc67b5fe4b146a Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 29 Aug 2015 12:45:39 -0700 Subject: [PATCH] Improve config migrate messages --- cat-main.go | 3 +-- config.go | 28 ++++++++++++++-------------- pb.go | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/cat-main.go b/cat-main.go index 62b01c94..a87b1407 100644 --- a/cat-main.go +++ b/cat-main.go @@ -84,7 +84,7 @@ func mainCat(ctx *cli.Context) { // handle std input data if stdinMode { - fatalIf(catOut(os.Stdin).Trace(), "Unable to read from stdin.") + fatalIf(catOut(os.Stdin).Trace(), "Unable to read from standard input.") return } @@ -96,7 +96,6 @@ func mainCat(ctx *cli.Context) { func catURL(sourceURL string) *probe.Error { config := mustGetMcConfig() - URL, err := getCanonicalizedURL(sourceURL, config.Aliases) if err != nil { return err.Trace(sourceURL) diff --git a/config.go b/config.go index de9e83db..3882bd6b 100644 --- a/config.go +++ b/config.go @@ -149,7 +149,7 @@ func getMcConfig() (*configV3, *probe.Error) { // mustGetMcConfig - reads configuration file and returns configs, exits on error func mustGetMcConfig() *configV3 { config, err := getMcConfig() - fatalIf(err.Trace(), "Unable to get mcConfig.") + fatalIf(err.Trace(), "Unable to read mc configuration.") return config } @@ -204,7 +204,7 @@ func migrateConfigV1ToV101() { return } mcConfigV1, err := quick.Load(mustGetMcConfigPath(), newConfigV1()) - fatalIf(err.Trace(), "Unable to load config.") + fatalIf(err.Trace(), "Unable to load config version ‘1’.") // update to newer version if mcConfigV1.Version() == "1.0.0" { @@ -236,10 +236,10 @@ func migrateConfigV1ToV101() { } mcNewConfigV101, err := quick.New(confV101) - fatalIf(err.Trace(), "Unable to initialize quick config.") + fatalIf(err.Trace(), "Unable to initialize quick config for config version ‘1.0.1’.") err = mcNewConfigV101.Save(mustGetMcConfigPath()) - fatalIf(err.Trace(), "Unable to save config.") + fatalIf(err.Trace(), "Unable to save config version ‘1.0.1’.") console.Infof("Successfully migrated %s from version ‘1.0.0’ to version ‘1.0.1’.\n", mustGetMcConfigPath()) } @@ -250,7 +250,7 @@ func migrateConfigV101ToV2() { return } mcConfigV101, err := quick.Load(mustGetMcConfigPath(), newConfigV101()) - fatalIf(err.Trace(), "Unable to load config.") + fatalIf(err.Trace(), "Unable to load config version ‘1.0.1’.") // update to newer version if mcConfigV101.Version() == "1.0.1" { @@ -258,12 +258,12 @@ func migrateConfigV101ToV2() { confV2.Version = "2" mcNewConfigV2, err := quick.New(confV2) - fatalIf(err.Trace(), "Unable to initialize quick config.") + fatalIf(err.Trace(), "Unable to initialize quick config for config version ‘2’.") err = mcNewConfigV2.Save(mustGetMcConfigPath()) - fatalIf(err.Trace(), "Unable to save config.") + fatalIf(err.Trace(), "Unable to save config version ‘2’.") - console.Infof("Successfully migrated %s from version ‘1.0.1’ to version: ‘2’.\n", mustGetMcConfigPath()) + console.Infof("Successfully migrated %s from version ‘1.0.1’ to version ‘2’.\n", mustGetMcConfigPath()) } } @@ -272,7 +272,7 @@ func migrateConfigV2ToV3() { return } mcConfigV2, err := quick.Load(mustGetMcConfigPath(), newConfigV2()) - fatalIf(err.Trace(), "Unable to load config.") + fatalIf(err.Trace(), "Unable to load mc config V2.") // update to newer version if mcConfigV2.Version() == "2" { @@ -288,12 +288,12 @@ func migrateConfigV2ToV3() { confV3.Version = globalMCConfigVersion mcNewConfigV3, err := quick.New(confV3) - fatalIf(err.Trace(), "Unable to initialize quick config.") + fatalIf(err.Trace(), "Unable to initialize quick config for config version ‘3’.") err = mcNewConfigV3.Save(mustGetMcConfigPath()) - fatalIf(err.Trace(), "Unable to save config.") + fatalIf(err.Trace(), "Unable to save config version ‘3’.") - console.Infof("Successfully migrated %s from version ‘2’ to version: ‘3’.\n", mustGetMcConfigPath()) + console.Infof("Successfully migrated %s from version ‘2’ to version ‘3’.\n", mustGetMcConfigPath()) } } @@ -336,10 +336,10 @@ func fixConfigV3() { confV3.Version = globalMCConfigVersion mcNewConfigV3, err := quick.New(confV3) - fatalIf(err.Trace(), "Unable to initialize quick config.") + fatalIf(err.Trace(), "Unable to initialize quick config for config version ‘3’.") err = mcNewConfigV3.Save(mustGetMcConfigPath()) - fatalIf(err.Trace(), "Unable to save config.") + fatalIf(err.Trace(), "Unable to save config version ‘3’.") console.Infof("Successfully fixed %s broken config for version ‘3’.\n", mustGetMcConfigPath()) } diff --git a/pb.go b/pb.go index 598c7f58..befdf7ef 100644 --- a/pb.go +++ b/pb.go @@ -226,7 +226,7 @@ func scanBarFactory(prefix string) scanBarFunc { fileCount := 0 termSize, err := ts.GetSize() if err != nil { - fatalIf(probe.NewError(err), "Unable to get terminal size.") + fatalIf(probe.NewError(err), "Unable to get terminal size. Please enable --quiet mode for simpler terminals") } termWidth := termSize.Col() cursorCh := cursorAnimate()