From 26fbc3bc2071c1efd088a68e74523221ceed2d3f Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 20 May 2015 20:34:03 -0700 Subject: [PATCH] Change closed brackets to quote characters and remove brackets for Reason --- cmd-access.go | 12 ++++++------ cmd-cat.go | 9 +++++---- cmd-diff.go | 20 ++++++++++---------- cmd-ls.go | 12 ++++++------ cmd-mb.go | 12 ++++++------ cmd-update.go | 2 +- diff.go | 18 +++++++++--------- main.go | 4 ++-- 8 files changed, 45 insertions(+), 44 deletions(-) diff --git a/cmd-access.go b/cmd-access.go index 2eee5dda..4771b0d4 100644 --- a/cmd-access.go +++ b/cmd-access.go @@ -44,23 +44,23 @@ func runAccessCmd(ctx *cli.Context) { switch e := iodine.ToError(err).(type) { case errUnsupportedScheme: console.Debugln(iodine.New(err, nil)) - console.Fatalf("reading URL [%s] failed with following reason: [%s]\n", e.url, e) + console.Fatalf("Unknown type of URL ‘%s’. Reason: %s.\n", e.url, e) default: console.Debugln(iodine.New(err, nil)) - console.Fatalf("reading URLs failed with following reason: [%s]\n", e) + console.Fatalf("reading URLs failed with following Reason: %s\n", e) } } acl := bucketACL(ctx.Args().First()) if !acl.isValidBucketACL() { console.Debugln(iodine.New(errInvalidACL{acl: acl.String()}, nil)) - console.Fatalf("Access type [%s] is not supported. Valid types are [private, public, readonly].\n", acl) + console.Fatalf("Access type ‘%s’ is not supported. Valid types are [private, public, readonly].\n", acl) } targetURLs = targetURLs[1:] // 1 or more target URLs for _, targetURL := range targetURLs { targetConfig, err := getHostConfig(targetURL) if err != nil { console.Debugln(iodine.New(err, nil)) - console.Fatalf("Unable to read configuration for host [%s]. Reason: [%s].\n", targetURL, iodine.ToError(err)) + console.Fatalf("Unable to read configuration for host ‘%s’. Reason: %s.\n", targetURL, iodine.ToError(err)) } targetURLConfigMap[targetURL] = targetConfig } @@ -83,7 +83,7 @@ func doUpdateAccessCmd(targetURL, targetACL string, targetConfig *hostConfig, de clnt, err = getNewClient(targetURL, targetConfig, debug) if err != nil { err := iodine.New(err, nil) - msg := fmt.Sprintf("Unable to initialize client for [%s]. Reason: [%s].\n", + msg := fmt.Sprintf("Unable to initialize client for ‘%s’. Reason: %s.\n", targetURL, iodine.ToError(err)) return msg, err } @@ -100,7 +100,7 @@ func doUpdateAccess(clnt client.Client, targetURL, targetACL string) (string, er } if err != nil { err := iodine.New(err, nil) - msg := fmt.Sprintf("Failed to add bucket access policy for URL [%s]. Reason: [%s].\n", targetURL, iodine.ToError(err)) + msg := fmt.Sprintf("Failed to add bucket access policy for URL ‘%s’. Reason: %s.\n", targetURL, iodine.ToError(err)) return msg, err } return "", nil diff --git a/cmd-cat.go b/cmd-cat.go index ee05adf3..294f9889 100644 --- a/cmd-cat.go +++ b/cmd-cat.go @@ -36,7 +36,7 @@ func runCatCmd(ctx *cli.Context) { config, err := getMcConfig() if err != nil { console.Debugln(iodine.New(err, nil)) - console.Fatalf("loading config file failed with following reason: [%s]\n", iodine.ToError(err)) + console.Fatalf("Unable to read config file ‘%s’. Reason: %s.\n", mustGetMcConfigPath(), iodine.ToError(err)) } // Convert arguments to URLs: expand alias, fix format... @@ -45,10 +45,10 @@ func runCatCmd(ctx *cli.Context) { switch e := iodine.ToError(err).(type) { case errUnsupportedScheme: console.Debugln(iodine.New(err, nil)) - console.Fatalf("reading URL [%s] failed with following reason: [%s]\n", e.url, e) + console.Fatalf("Unknown type of URL ‘%s’. Reason: %s.\n", e.url, e) default: console.Debugln(iodine.New(err, nil)) - console.Fatalf("reading URLs failed with following reason: [%s]\n", e) + console.Fatalf("Unable to parse arguments. Reason: %s.\n", iodine.ToError(err)) } } @@ -56,7 +56,8 @@ func runCatCmd(ctx *cli.Context) { sourceURLConfigMap, err := getHostConfigs(sourceURLs) if err != nil { console.Debugln(iodine.New(err, nil)) - console.Fatalf("reading host config for URL [%s] failed with following reason: [%s]\n", sourceURLs, iodine.ToError(err)) + console.Fatalf("Unable to read host configuration for ‘%s’ from config file ‘%s’. Reason: %s.\n", + sourceURLs, mustGetMcConfigPath(), iodine.ToError(err)) } humanReadable, err := doCatCmd(sourceURLConfigMap, globalDebugFlag) if err != nil { diff --git a/cmd-diff.go b/cmd-diff.go index 57ac3226..0092e2cf 100644 --- a/cmd-diff.go +++ b/cmd-diff.go @@ -32,7 +32,7 @@ func runDiffCmd(ctx *cli.Context) { } config, err := getMcConfig() if err != nil { - console.Fatalf("Unable to read config file [%s]. Reason: [%s].\n", mustGetMcConfigPath(), iodine.ToError(err)) + console.Fatalf("Unable to read config file ‘%s’. Reason: %s.\n", mustGetMcConfigPath(), iodine.ToError(err)) } firstURL := ctx.Args().First() @@ -42,21 +42,21 @@ func runDiffCmd(ctx *cli.Context) { if err != nil { switch iodine.ToError(err).(type) { case errUnsupportedScheme: - console.Fatalf("Unknown type of URL [%s].\n", firstURL) + console.Fatalf("Unknown type of URL ‘%s’.\n", firstURL) default: - console.Fatalf("Unable to parse argument [%s]. Reason: [%s].\n", firstURL, iodine.ToError(err)) + console.Fatalf("Unable to parse argument ‘%s’. Reason: %s.\n", firstURL, iodine.ToError(err)) } } _, err = getHostConfig(firstURL) if err != nil { - console.Fatalf("Unable to read host configuration for [%s] from config file [%s]. Reason: [%s].\n", + console.Fatalf("Unable to read host configuration for ‘%s’ from config file ‘%s’. Reason: %s.\n", firstURL, mustGetMcConfigPath(), iodine.ToError(err)) } _, err = getHostConfig(secondURL) if err != nil { - console.Fatalf("Unable to read host configuration for [%s] from config file [%s]. Reason: [%s].\n", + console.Fatalf("Unable to read host configuration for ‘%s’ from config file ‘%s’. Reason: %s.\n", secondURL, mustGetMcConfigPath(), iodine.ToError(err)) } @@ -64,9 +64,9 @@ func runDiffCmd(ctx *cli.Context) { if err != nil { switch iodine.ToError(err).(type) { case errUnsupportedScheme: - console.Fatalf("Unknown type of URL [%s].\n", secondURL) + console.Fatalf("Unknown type of URL ‘%s’. Reason: %s.\n", secondURL, iodine.ToError(err)) default: - console.Fatalf("Unable to parse argument [%s]. Reason: [%s].\n", secondURL, iodine.ToError(err)) + console.Fatalf("Unable to parse argument ‘%s’. Reason: %s.\n", secondURL, iodine.ToError(err)) } } // TODO recursive is not working yet @@ -84,7 +84,7 @@ func doDiffInRoutine(firstURL, secondURL string, recursive bool, ch chan diff) { _, firstContent, err := url2Stat(firstURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + firstURL + "’. Reason: [" + iodine.ToError(err).Error() + "]", + message: "Failed to stat ‘" + firstURL + "’. Reason: " + iodine.ToError(err).Error(), err: iodine.New(err, nil), } return @@ -92,7 +92,7 @@ func doDiffInRoutine(firstURL, secondURL string, recursive bool, ch chan diff) { _, secondContent, err := url2Stat(secondURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + secondURL + "’. Reason: [" + iodine.ToError(err).Error() + "]", + message: "Failed to stat ‘" + secondURL + "’. Reason: " + iodine.ToError(err).Error(), err: iodine.New(err, nil), } return @@ -104,7 +104,7 @@ func doDiffInRoutine(firstURL, secondURL string, recursive bool, ch chan diff) { if err != nil { ch <- diff{ message: "Unable to construct new URL from ‘" + secondURL + "’ using ‘" + - firstURL + "’. Reason: [" + iodine.ToError(err).Error() + "].", + firstURL + "’. Reason: " + iodine.ToError(err).Error(), err: iodine.New(err, nil), } return diff --git a/cmd-ls.go b/cmd-ls.go index 4225c49d..c570eb7e 100644 --- a/cmd-ls.go +++ b/cmd-ls.go @@ -33,25 +33,25 @@ func runListCmd(ctx *cli.Context) { config, err := getMcConfig() if err != nil { console.Debugln(iodine.New(err, nil)) - console.Fatalf("Unable to read config file [%s]. Reason: [%s].\n", mustGetMcConfigPath(), iodine.ToError(err)) + console.Fatalf("Unable to read config file ‘%s’. Reason: %s.\n", mustGetMcConfigPath(), iodine.ToError(err)) } targetURLConfigMap := make(map[string]*hostConfig) for _, arg := range ctx.Args() { targetURL, err := getExpandedURL(arg, config.Aliases) if err != nil { - switch iodine.ToError(err).(type) { + switch e := iodine.ToError(err).(type) { case errUnsupportedScheme: console.Debugln(iodine.New(err, nil)) - console.Fatalf("Unknown type of URL [%s].\n", arg) + console.Fatalf("Unknown type of URL ‘%s’. Reason: %s.\n", e.url, e) default: console.Debugln(iodine.New(err, nil)) - console.Fatalf("Unable to parse argument [%s]. Reason: [%s].\n", arg, iodine.ToError(err)) + console.Fatalf("Unable to parse argument ‘%s’. Reason: %s.\n", arg, iodine.ToError(err)) } } targetConfig, err := getHostConfig(targetURL) if err != nil { console.Debugln(iodine.New(err, nil)) - console.Fatalf("Unable to read host configuration for [%s] from config file [%s]. Reason: [%s].\n", + console.Fatalf("Unable to read host configuration for ‘%s’ from config file ‘%s’. Reason: %s.\n", targetURL, mustGetMcConfigPath(), iodine.ToError(err)) } targetURLConfigMap[targetURL] = targetConfig @@ -63,7 +63,7 @@ func runListCmd(ctx *cli.Context) { err = iodine.New(err, nil) if err != nil { console.Debugln(err) - console.Fatalf("Failed to list [%s]. Reason: [%s].\n", targetURL, iodine.ToError(err)) + console.Fatalf("Failed to list ‘%s’. Reason: %s.\n", targetURL, iodine.ToError(err)) } } } diff --git a/cmd-mb.go b/cmd-mb.go index c56a1d1f..ef824826 100644 --- a/cmd-mb.go +++ b/cmd-mb.go @@ -37,7 +37,7 @@ func runMakeBucketCmd(ctx *cli.Context) { config, err := getMcConfig() if err != nil { console.Debugln(iodine.New(err, nil)) - console.Fatalf("Unable to read config file [%s].\n", mustGetMcConfigPath()) + console.Fatalf("Unable to read config file ‘%s’. Reason: %s\n", mustGetMcConfigPath(), iodine.ToError(err)) } targetURLConfigMap := make(map[string]*hostConfig) targetURLs, err := getExpandedURLs(ctx.Args(), config.Aliases) @@ -45,17 +45,17 @@ func runMakeBucketCmd(ctx *cli.Context) { switch e := iodine.ToError(err).(type) { case errUnsupportedScheme: console.Debugln(iodine.New(err, nil)) - console.Fatalf("Unknown URL type [%s] passed. Reason: [%s].\n", e.url, e) + console.Fatalf("Unknown URL type ‘%s’ passed. Reason: %s.\n", e.url, e) default: console.Debugln(iodine.New(err, nil)) - console.Fatalf("Error in parsing path or URL. Reason: [%s].\n", e) + console.Fatalf("Error in parsing path or URL. Reason: %s.\n", e) } } for _, targetURL := range targetURLs { targetConfig, err := getHostConfig(targetURL) if err != nil { console.Debugln(iodine.New(err, nil)) - console.Fatalf("Unable to read configuration for host [%s]. Reason: [%s].\n", targetURL, iodine.ToError(err)) + console.Fatalf("Unable to read configuration for host ‘%s’. Reason: %s.\n", targetURL, iodine.ToError(err)) } targetURLConfigMap[targetURL] = targetConfig } @@ -79,7 +79,7 @@ func doMakeBucketCmd(targetURL string, targetConfig *hostConfig, debug bool) (st clnt, err = getNewClient(targetURL, targetConfig, debug) if err != nil { err := iodine.New(err, nil) - msg := fmt.Sprintf("Unable to initialize client for [%s]. Reason: [%s].\n", + msg := fmt.Sprintf("Unable to initialize client for ‘%s’. Reason: %s.\n", targetURL, iodine.ToError(err)) return msg, err } @@ -97,7 +97,7 @@ func doMakeBucket(clnt client.Client, targetURL string) (string, error) { } if err != nil { err := iodine.New(err, nil) - msg := fmt.Sprintf("Failed to create bucket for URL [%s]. Reason: [%s].\n", targetURL, iodine.ToError(err)) + msg := fmt.Sprintf("Failed to create bucket for URL ‘%s’. Reason: %s.\n", targetURL, iodine.ToError(err)) return msg, err } return "", nil diff --git a/cmd-update.go b/cmd-update.go index 17338b1e..814884a4 100644 --- a/cmd-update.go +++ b/cmd-update.go @@ -61,7 +61,7 @@ func runUpdateCmd(ctx *cli.Context) { hostConfig, err := getHostConfig(mcUpdateURL) if err != nil { console.Debugln(iodine.New(err, nil)) - console.Fatalf("Unable to read configuration for host [%s]. Reason: [%s].\n", mcUpdateURL, iodine.ToError(err)) + console.Fatalf("Unable to read configuration for host ‘%s’. Reason: %s.\n", mcUpdateURL, iodine.ToError(err)) } msg, err := doUpdateCheck(hostConfig) if err != nil { diff --git a/diff.go b/diff.go index 88d93f87..9cf69a2d 100644 --- a/diff.go +++ b/diff.go @@ -48,7 +48,7 @@ func doDiffObjects(firstURL, secondURL string, ch chan diff) { _, firstContent, err := url2Stat(firstURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + firstURL + "’ " + "Reason: [" + iodine.ToError(err).Error() + "].", + message: "Failed to stat ‘" + firstURL + "’ " + "Reason: " + iodine.ToError(err).Error() + ".", err: iodine.New(err, nil), } return @@ -57,7 +57,7 @@ func doDiffObjects(firstURL, secondURL string, ch chan diff) { _, secondContent, err := url2Stat(secondURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + secondURL + "’ " + "Reason: [" + iodine.ToError(err).Error() + "].", + message: "Failed to stat ‘" + secondURL + "’ " + "Reason: " + iodine.ToError(err).Error() + ".", err: iodine.New(err, nil), } return @@ -96,7 +96,7 @@ func doDiffDirs(firstURL, secondURL string, recursive bool, ch chan diff) { firstClnt, firstContent, err := url2Stat(firstURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + firstURL + "’ ." + "Reason: [" + iodine.ToError(err).Error() + "].", + message: "Failed to stat ‘" + firstURL + "’ ." + "Reason: " + iodine.ToError(err).Error() + ".", err: iodine.New(err, nil), } return @@ -104,7 +104,7 @@ func doDiffDirs(firstURL, secondURL string, recursive bool, ch chan diff) { _, secondContent, err := url2Stat(secondURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + secondURL + "’ ." + "Reason: [" + iodine.ToError(err).Error() + "].", + message: "Failed to stat ‘" + secondURL + "’ ." + "Reason: " + iodine.ToError(err).Error() + ".", err: iodine.New(err, nil), } return @@ -127,7 +127,7 @@ func doDiffDirs(firstURL, secondURL string, recursive bool, ch chan diff) { for contentCh := range firstClnt.List(recursive) { if contentCh.Err != nil { ch <- diff{ - message: "Failed to list ‘" + firstURL + "’. Reason: [" + iodine.ToError(contentCh.Err).Error() + "].", + message: "Failed to list ‘" + firstURL + "’. Reason: " + iodine.ToError(contentCh.Err).Error() + ".", err: iodine.New(contentCh.Err, nil), } return @@ -136,7 +136,7 @@ func doDiffDirs(firstURL, secondURL string, recursive bool, ch chan diff) { if err != nil { ch <- diff{ message: "Unable to construct new URL from ‘" + firstURL + "’ using ‘" + - contentCh.Content.Name + "’. Reason: [" + iodine.ToError(err).Error() + "].", + contentCh.Content.Name + "’. Reason: " + iodine.ToError(err).Error() + ".", err: iodine.New(err, nil), } return @@ -145,7 +145,7 @@ func doDiffDirs(firstURL, secondURL string, recursive bool, ch chan diff) { if err != nil { ch <- diff{ message: "Unable to construct new URL from ‘" + secondURL + "’ using ‘" + - contentCh.Content.Name + "’. Reason: [" + iodine.ToError(err).Error() + "].", + contentCh.Content.Name + "’. Reason: " + iodine.ToError(err).Error() + ".", err: iodine.New(err, nil), } return @@ -153,7 +153,7 @@ func doDiffDirs(firstURL, secondURL string, recursive bool, ch chan diff) { _, newFirstContent, err := url2Stat(newFirstURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + newFirstURL + "’. Reason: [" + iodine.ToError(err).Error() + "].", + message: "Failed to stat ‘" + newFirstURL + "’. Reason: " + iodine.ToError(err).Error() + ".", err: iodine.New(err, nil), } return @@ -161,7 +161,7 @@ func doDiffDirs(firstURL, secondURL string, recursive bool, ch chan diff) { _, newSecondContent, err := url2Stat(newSecondURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + newSecondURL + "’. Reason: [" + iodine.ToError(err).Error() + "].", + message: "Failed to stat ‘" + newSecondURL + "’. Reason: " + iodine.ToError(err).Error() + ".", err: iodine.New(err, nil), } return diff --git a/main.go b/main.go index ee9ec543..c4216cfb 100644 --- a/main.go +++ b/main.go @@ -112,10 +112,10 @@ func main() { if console.IsValidTheme(themeName) { err := console.SetTheme(themeName) if err != nil { - console.Fatalf("Failed to set theme [%s]. Reason: [%s].\n", themeName, iodine.ToError(err)) + console.Fatalf("Failed to set theme ‘%s’. Reason: %s.\n", themeName, iodine.ToError(err)) } } else { - console.Fatalf("Theme [%s] is not supported. Please choose from this list: %s.\n", themeName, console.GetThemeNames()) + console.Fatalf("Theme ‘%s’ is not supported. Please choose from this list: %s.\n", themeName, console.GetThemeNames()) } checkConfig() return nil