1
0
mirror of https://github.com/minio/mc.git synced 2025-11-13 12:22:45 +03:00

Change closed brackets to quote characters and remove brackets for Reason

This commit is contained in:
Harshavardhana
2015-05-20 20:34:03 -07:00
parent e0e860588a
commit 26fbc3bc20
8 changed files with 45 additions and 44 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -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

View File

@@ -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))
}
}
}

View File

@@ -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

View File

@@ -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 {

18
diff.go
View File

@@ -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

View File

@@ -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