1
0
mirror of https://github.com/minio/mc.git synced 2025-08-08 02:02:54 +03:00

Use ` instead of unicode single quote (#2033)

‘ is not supported in some dumb terminals, use ` instead
This commit is contained in:
Anis Elleuch
2017-02-25 20:08:32 +01:00
committed by Harshavardhana
parent 2ca601ef22
commit 798775775b
28 changed files with 185 additions and 185 deletions

View File

@@ -55,7 +55,7 @@ type serviceRestartMessage struct {
// String colorized make bucket message.
func (s serviceRestartMessage) String() string {
return console.Colorize("ServiceRestart", "Restarted "+s.ServerURL+" successfully.")
return console.Colorize("ServiceRestart", "Restarted `"+s.ServerURL+"` successfully.")
}
// JSON jsonified make bucket message.

View File

@@ -69,7 +69,7 @@ func checkCatSyntax(ctx *cli.Context) {
}
for _, arg := range args {
if strings.HasPrefix(arg, "-") && len(arg) > 1 {
fatalIf(probe.NewError(errors.New("")), fmt.Sprintf("Unknown flag %s passed.", arg))
fatalIf(probe.NewError(errors.New("")), fmt.Sprintf("Unknown flag `%s` passed.", arg))
}
}
}
@@ -151,7 +151,7 @@ func mainCat(ctx *cli.Context) error {
return nil
}
// if Args contain -, we need to preserve its order specially.
// if Args contain `-`, we need to preserve its order specially.
args := []string(ctx.Args())
if ctx.Args().First() == "-" {
for i, arg := range os.Args {
@@ -165,7 +165,7 @@ func mainCat(ctx *cli.Context) error {
// Convert arguments to URLs: expand alias, fix format.
for _, url := range args {
fatalIf(catURL(url).Trace(url), "Unable to read from "+url+".")
fatalIf(catURL(url).Trace(url), "Unable to read from `"+url+"`.")
}
return nil
}

View File

@@ -27,7 +27,7 @@ type APINotImplemented struct {
}
func (e APINotImplemented) Error() string {
return "" + e.API + " is not supported for " + e.APIType + "."
return "`" + e.API + "` is not supported for `" + e.APIType + "`."
}
// GenericBucketError - generic bucket operations error
@@ -39,14 +39,14 @@ type GenericBucketError struct {
type BucketDoesNotExist GenericBucketError
func (e BucketDoesNotExist) Error() string {
return "Bucket " + e.Bucket + " does not exist."
return "Bucket `" + e.Bucket + "` does not exist."
}
// BucketExists - bucket exists.
type BucketExists GenericBucketError
func (e BucketExists) Error() string {
return "Bucket " + e.Bucket + " exists."
return "Bucket `" + e.Bucket + "` exists."
}
// BucketNameEmpty - bucket name empty (http://goo.gl/wJlzDz)
@@ -71,7 +71,7 @@ type ObjectAlreadyExists struct {
}
func (e ObjectAlreadyExists) Error() string {
return "Object " + e.Object + " already exists."
return "Object `" + e.Object + "` already exists."
}
// ObjectAlreadyExistsAsDirectory - typed return for XMinioObjectExistsAsDirectory
@@ -80,7 +80,7 @@ type ObjectAlreadyExistsAsDirectory struct {
}
func (e ObjectAlreadyExistsAsDirectory) Error() string {
return "Object " + e.Object + " already exists as directory."
return "Object `" + e.Object + "` already exists as directory."
}
// ObjectOnGlacier - object is of storage class glacier.
@@ -89,7 +89,7 @@ type ObjectOnGlacier struct {
}
func (e ObjectOnGlacier) Error() string {
return "Object " + e.Object + " is on Glacier storage."
return "Object `" + e.Object + "` is on Glacier storage."
}
// BucketNameTopLevel - generic error
@@ -108,35 +108,35 @@ type GenericFileError struct {
type PathNotFound GenericFileError
func (e PathNotFound) Error() string {
return "Requested file " + e.Path + " not found"
return "Requested file `" + e.Path + "` not found"
}
// PathIsNotRegular (ENOTREG) - file is not a regular file.
type PathIsNotRegular GenericFileError
func (e PathIsNotRegular) Error() string {
return "Requested file " + e.Path + " is not a regular file."
return "Requested file `" + e.Path + "` is not a regular file."
}
// PathInsufficientPermission (EPERM) - permission denied.
type PathInsufficientPermission GenericFileError
func (e PathInsufficientPermission) Error() string {
return "Insufficient permissions to access this file " + e.Path + ""
return "Insufficient permissions to access this file `" + e.Path + "`"
}
// BrokenSymlink (ENOTENT) - file has broken symlink.
type BrokenSymlink GenericFileError
func (e BrokenSymlink) Error() string {
return "Requested file " + e.Path + " has broken symlink"
return "Requested file `" + e.Path + "` has broken symlink"
}
// TooManyLevelsSymlink (ELOOP) - file has too many levels of symlinks.
type TooManyLevelsSymlink GenericFileError
func (e TooManyLevelsSymlink) Error() string {
return "Requested file " + e.Path + " has too many levels of symlinks"
return "Requested file `" + e.Path + "` has too many levels of symlinks"
}
// EmptyPath (EINVAL) - invalid argument.
@@ -160,7 +160,7 @@ type UnexpectedShortWrite struct {
}
func (e UnexpectedShortWrite) Error() string {
msg := fmt.Sprintf("Wrote less data than requested. Expected %d bytes, but only wrote %d bytes.", e.InputSize, e.WriteSize)
msg := fmt.Sprintf("Wrote less data than requested. Expected `%d` bytes, but only wrote `%d` bytes.", e.InputSize, e.WriteSize)
return msg
}
@@ -171,7 +171,7 @@ type UnexpectedEOF struct {
}
func (e UnexpectedEOF) Error() string {
msg := fmt.Sprintf("Input reader closed pre-maturely. Expected %d bytes, but only received %d bytes.", e.TotalSize, e.TotalWritten)
msg := fmt.Sprintf("Input reader closed pre-maturely. Expected `%d` bytes, but only received `%d` bytes.", e.TotalSize, e.TotalWritten)
return msg
}
@@ -179,6 +179,6 @@ func (e UnexpectedEOF) Error() string {
type UnexpectedExcessRead UnexpectedEOF
func (e UnexpectedExcessRead) Error() string {
msg := fmt.Sprintf("Received excess data on input reader. Expected only %d bytes, but received %d bytes.", e.TotalSize, e.TotalWritten)
msg := fmt.Sprintf("Received excess data on input reader. Expected only `%d` bytes, but received `%d` bytes.", e.TotalSize, e.TotalWritten)
return msg
}

View File

@@ -45,7 +45,7 @@ func (s *TestSuite) TestURLJoinPath(c *C) {
url = urlJoinPath(url1, url2)
c.Assert(url, Equals, "http://s3.mycompany.io/dev/mybucket/bin/zgrep")
// Check if it strips URL2's tailing /
// Check if it strips URL2's tailing `/`
url1 = "http://s3.mycompany.io/dev"
url2 = "mybucket/bin/"
url = urlJoinPath(url1, url2)

View File

@@ -60,7 +60,7 @@ func newBrokenConfigV3() *brokenConfigV3 {
return conf
}
// Fix config version 3. Some v3 config files are written without
// Fix config version `3`. Some v3 config files are written without
// proper hostConfig JSON tags. They may also contain unused ACL and
// Access fields. Rewrite the hostConfig with proper fields using JSON
// tags and drop the unused (ACL, Access) fields.
@@ -102,12 +102,12 @@ func fixConfigV3() {
if isMutated {
mcNewConfigV3, e := quick.New(cfgV3)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version 3.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `3`.")
e = mcNewConfigV3.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version 3.")
fatalIf(probe.NewError(e), "Unable to save config version `3`.")
console.Infof("Successfully fixed %s broken config for version 3.\n", mustGetMcConfigPath())
console.Infof("Successfully fixed %s broken config for version `3`.\n", mustGetMcConfigPath())
}
}
@@ -158,10 +158,10 @@ func fixConfigV6ForHosts() {
if isMutated {
// Save the new config back to the disk.
mcCfgV6, e := quick.New(newCfgV6)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version v6.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `v6`.")
e = mcCfgV6.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version v6.")
fatalIf(probe.NewError(e), "Unable to save config version `v6`.")
}
}
@@ -189,7 +189,7 @@ func fixConfigV6() {
for host, hostCfg := range config.Data().(*configV6).Hosts {
if strings.Contains(host, "*") {
fatalIf(errInvalidArgument(),
fmt.Sprintf("Glob style * pattern matching is no longer supported. Please fix %s entry manually.", host))
fmt.Sprintf("Glob style `*` pattern matching is no longer supported. Please fix `%s` entry manually.", host))
}
if strings.Contains(host, "*s3*") || strings.Contains(host, "*.s3*") {
console.Infoln("Found glob url, replacing " + host + " with s3.amazonaws.com")
@@ -237,6 +237,6 @@ func fixConfigV6() {
e = newConf.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e).Trace(mustGetMcConfigPath()), "Unable to save newly fixed config path.")
console.Infof("Successfully fixed %s broken config for version 6.\n", mustGetMcConfigPath())
console.Infof("Successfully fixed %s broken config for version `6`.\n", mustGetMcConfigPath())
}
}

View File

@@ -98,9 +98,9 @@ func (h hostMessage) String() string {
}
return message
case "remove":
return console.Colorize("HostMessage", "Removed "+h.Alias+" successfully.")
return console.Colorize("HostMessage", "Removed `"+h.Alias+"` successfully.")
case "add":
return console.Colorize("HostMessage", "Added "+h.Alias+" successfully.")
return console.Colorize("HostMessage", "Added `"+h.Alias+"` successfully.")
default:
return ""
}
@@ -149,27 +149,27 @@ func checkConfigHostAddSyntax(ctx *cli.Context) {
api := tailArgs.Get(4)
if !isValidAlias(alias) {
fatalIf(errDummy().Trace(alias), "Invalid alias "+alias+".")
fatalIf(errDummy().Trace(alias), "Invalid alias `"+alias+"`.")
}
if !isValidHostURL(url) {
fatalIf(errDummy().Trace(url),
"Invalid URL "+url+".")
"Invalid URL `"+url+"`.")
}
if !isValidAccessKey(accessKey) {
fatalIf(errInvalidArgument().Trace(accessKey),
"Invalid access key "+accessKey+".")
"Invalid access key `"+accessKey+"`.")
}
if !isValidSecretKey(secretKey) {
fatalIf(errInvalidArgument().Trace(secretKey),
"Invalid secret key "+secretKey+".")
"Invalid secret key `"+secretKey+"`.")
}
if api != "" && !isValidAPI(api) { // Empty value set to default "S3v4".
fatalIf(errInvalidArgument().Trace(api),
"Unrecognized API signature. Valid options are [S3v4, S3v2].")
"Unrecognized API signature. Valid options are `[S3v4, S3v2]`.")
}
}
@@ -184,7 +184,7 @@ func checkConfigHostRemoveSyntax(ctx *cli.Context) {
if !isValidAlias(tailArgs.Get(0)) {
fatalIf(errDummy().Trace(tailArgs.Get(0)),
"Invalid alias "+tailArgs.Get(0)+".")
"Invalid alias `"+tailArgs.Get(0)+"`.")
}
}
@@ -234,13 +234,13 @@ func mainConfigHost(ctx *cli.Context) error {
// addHost - add a host config.
func addHost(alias string, hostCfgV8 hostConfigV8) {
mcCfgV8, err := loadMcConfig()
fatalIf(err.Trace(globalMCConfigVersion), "Unable to load config "+mustGetMcConfigPath()+".")
fatalIf(err.Trace(globalMCConfigVersion), "Unable to load config `"+mustGetMcConfigPath()+"`.")
// Add new host.
mcCfgV8.Hosts[alias] = hostCfgV8
err = saveMcConfig(mcCfgV8)
fatalIf(err.Trace(alias), "Unable to update hosts in config version "+mustGetMcConfigPath()+".")
fatalIf(err.Trace(alias), "Unable to update hosts in config version `"+mustGetMcConfigPath()+"`.")
printMsg(hostMessage{
op: "add",
@@ -255,13 +255,13 @@ func addHost(alias string, hostCfgV8 hostConfigV8) {
// removeHost - removes a host.
func removeHost(alias string) {
conf, err := loadMcConfig()
fatalIf(err.Trace(globalMCConfigVersion), "Unable to load config version "+globalMCConfigVersion+".")
fatalIf(err.Trace(globalMCConfigVersion), "Unable to load config version `"+globalMCConfigVersion+"`.")
// Remove host.
delete(conf.Hosts, alias)
err = saveMcConfig(conf)
fatalIf(err.Trace(alias), "Unable to save deleted hosts in config version "+globalMCConfigVersion+".")
fatalIf(err.Trace(alias), "Unable to save deleted hosts in config version `"+globalMCConfigVersion+"`.")
printMsg(hostMessage{op: "remove", Alias: alias})
}
@@ -276,7 +276,7 @@ func (d byAlias) Less(i, j int) bool { return d[i].Alias < d[j].Alias }
// listHosts - list all host URLs.
func listHosts() {
conf, err := loadMcConfig()
fatalIf(err.Trace(globalMCConfigVersion), "Unable to load config version "+globalMCConfigVersion+".")
fatalIf(err.Trace(globalMCConfigVersion), "Unable to load config version `"+globalMCConfigVersion+"`.")
var maxAlias = 0
for k := range conf.Hosts {

View File

@@ -51,7 +51,7 @@ func migrateConfigV1ToV101() {
return
}
mcCfgV1, e := quick.Load(mustGetMcConfigPath(), newConfigV1())
fatalIf(probe.NewError(e), "Unable to load config version 1.")
fatalIf(probe.NewError(e), "Unable to load config version `1`.")
// If loaded config version does not match 1.0.0, we do nothing.
if mcCfgV1.Version() != "1.0.0" {
@@ -95,20 +95,20 @@ func migrateConfigV1ToV101() {
// Save the new config back to the disk.
mcCfgV101, e := quick.New(cfgV101)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version 1.0.1.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `1.0.1`.")
e = mcCfgV101.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version 1.0.1.")
fatalIf(probe.NewError(e), "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())
console.Infof("Successfully migrated %s from version `1.0.0` to version `1.0.1`.\n", mustGetMcConfigPath())
}
// Migrate from config 1.0.1 to 2. Drop semantic versioning and move to integer versioning. No other changes.
// Migrate from config `1.0.1` to `2`. Drop semantic versioning and move to integer versioning. No other changes.
func migrateConfigV101ToV2() {
if !isMcConfigExists() {
return
}
mcCfgV101, e := quick.Load(mustGetMcConfigPath(), newConfigV101())
fatalIf(probe.NewError(e), "Unable to load config version 1.0.1.")
fatalIf(probe.NewError(e), "Unable to load config version `1.0.1`.")
// update to newer version
if mcCfgV101.Version() != "1.0.1" {
@@ -131,15 +131,15 @@ func migrateConfigV101ToV2() {
}
mcCfgV2, e := quick.New(cfgV2)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version 2.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `2`.")
e = mcCfgV2.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version 2.")
fatalIf(probe.NewError(e), "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())
}
// Migrate from config 2 to 3. Use - separated names for
// Migrate from config `2` to `3`. Use `-` separated names for
// hostConfig using struct json tags.
func migrateConfigV2ToV3() {
if !isMcConfigExists() {
@@ -171,15 +171,15 @@ func migrateConfigV2ToV3() {
}
mcNewCfgV3, e := quick.New(cfgV3)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version 3.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `3`.")
e = mcNewCfgV3.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version 3.")
fatalIf(probe.NewError(e), "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())
}
// Migrate from config version 3 to 4. Introduce API Signature
// Migrate from config version `3` to `4`. Introduce API Signature
// field in host config. Also Use JavaScript notation for field names.
func migrateConfigV3ToV4() {
if !isMcConfigExists() {
@@ -210,16 +210,16 @@ func migrateConfigV3ToV4() {
}
mcNewCfgV4, e := quick.New(cfgV4)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version 4.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `4`.")
e = mcNewCfgV4.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version 4.")
fatalIf(probe.NewError(e), "Unable to save config version `4`.")
console.Infof("Successfully migrated %s from version 3 to version 4.\n", mustGetMcConfigPath())
console.Infof("Successfully migrated %s from version `3` to version `4`.\n", mustGetMcConfigPath())
}
// Migrate config version 4 to 5. Rename hostConfigV4.Signature -> hostConfigV5.API.
// Migrate config version `4` to `5`. Rename hostConfigV4.Signature -> hostConfigV5.API.
func migrateConfigV4ToV5() {
if !isMcConfigExists() {
return
@@ -245,15 +245,15 @@ func migrateConfigV4ToV5() {
}
mcNewCfgV5, e := quick.New(cfgV5)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version 5.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `5`.")
e = mcNewCfgV5.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version 5.")
fatalIf(probe.NewError(e), "Unable to save config version `5`.")
console.Infof("Successfully migrated %s from version 4 to version 5.\n", mustGetMcConfigPath())
console.Infof("Successfully migrated %s from version `4` to version `5`.\n", mustGetMcConfigPath())
}
// Migrate config version 5 to 6. Add google cloud storage servers
// Migrate config version `5` to `6`. Add google cloud storage servers
// to host config. Also remove "." from s3 aws glob rule.
func migrateConfigV5ToV6() {
if !isMcConfigExists() {
@@ -311,15 +311,15 @@ func migrateConfigV5ToV6() {
}
mcNewCfgV6, e := quick.New(cfgV6)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version 6.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `6`.")
e = mcNewCfgV6.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version 6.")
fatalIf(probe.NewError(e), "Unable to save config version `6`.")
console.Infof("Successfully migrated %s from version 5 to version 6.\n", mustGetMcConfigPath())
console.Infof("Successfully migrated %s from version `5` to version `6`.\n", mustGetMcConfigPath())
}
// Migrate config version 6 to 7'. Remove alias map and introduce
// Migrate config version `6` to `7'. Remove alias map and introduce
// named Host config. Also no more glob match for host config entries.
func migrateConfigV6ToV7() {
if !isMcConfigExists() {
@@ -390,15 +390,15 @@ func migrateConfigV6ToV7() {
// Load default settings.
cfgV7.loadDefaults()
mcNewCfgV7, e := quick.New(cfgV7)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version 7.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `7`.")
e = mcNewCfgV7.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version 7.")
fatalIf(probe.NewError(e), "Unable to save config version `7`.")
console.Infof("Successfully migrated %s from version 6 to version 7.\n", mustGetMcConfigPath())
console.Infof("Successfully migrated %s from version `6` to version `7`.\n", mustGetMcConfigPath())
}
// Migrate config version 7 to 8'. Remove hosts
// Migrate config version `7` to `8'. Remove hosts
// 'play.minio.io:9002' and 'dl.minio.io:9000'.
func migrateConfigV7ToV8() {
if !isMcConfigExists() {
@@ -429,10 +429,10 @@ func migrateConfigV7ToV8() {
// Load default settings.
cfgV8.loadDefaults()
mcNewCfgV8, e := quick.New(cfgV8)
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version 8.")
fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `8`.")
e = mcNewCfgV8.Save(mustGetMcConfigPath())
fatalIf(probe.NewError(e), "Unable to save config version 8.")
fatalIf(probe.NewError(e), "Unable to save config version `8`.")
console.Infof("Successfully migrated %s from version 7 to version 8.\n", mustGetMcConfigPath())
console.Infof("Successfully migrated %s from version `7` to version `8`.\n", mustGetMcConfigPath())
}

View File

@@ -94,7 +94,7 @@ type copyMessage struct {
// String colorized copy message
func (c copyMessage) String() string {
return console.Colorize("Copy", fmt.Sprintf("%s -> %s", c.Source, c.Target))
return console.Colorize("Copy", fmt.Sprintf("`%s` -> `%s`", c.Source, c.Target))
}
// JSON jsonified copy message
@@ -209,7 +209,7 @@ func doPrepareCopyURLs(session *sessionV8, trapCh <-chan bool) {
console.Eraseline()
}
if strings.Contains(cpURLs.Error.ToGoError().Error(), " is a folder.") {
errorIf(cpURLs.Error.Trace(), "Folder cannot be copied. Please use ... suffix.")
errorIf(cpURLs.Error.Trace(), "Folder cannot be copied. Please use `...` suffix.")
} else {
errorIf(cpURLs.Error.Trace(), "Unable to prepare URL for copying.")
}
@@ -297,7 +297,7 @@ func doCopySession(session *sessionV8) {
console.Eraseline()
}
errorIf(cpURLs.Error.Trace(cpURLs.SourceContent.URL.String()),
fmt.Sprintf("Failed to copy %s.", cpURLs.SourceContent.URL.String()))
fmt.Sprintf("Failed to copy `%s`.", cpURLs.SourceContent.URL.String()))
if isErrIgnored(cpURLs.Error) {
continue
}

View File

@@ -50,7 +50,7 @@ func checkCopySyntax(ctx *cli.Context) {
url := newClientURL(tgtURL)
if url.Host != "" {
if url.Path == string(url.Separator) {
fatalIf(errInvalidArgument().Trace(), fmt.Sprintf("Target %s does not contain bucket name.", tgtURL))
fatalIf(errInvalidArgument().Trace(), fmt.Sprintf("Target `%s` does not contain bucket name.", tgtURL))
}
}
@@ -81,10 +81,10 @@ func checkCopySyntaxTypeA(srcURLs []string, tgtURL string) {
}
srcURL := srcURLs[0]
_, srcContent, err := url2Stat(srcURL)
fatalIf(err.Trace(srcURL), "Unable to stat source "+srcURL+".")
fatalIf(err.Trace(srcURL), "Unable to stat source `"+srcURL+"`.")
if !srcContent.Type.IsRegular() {
fatalIf(errInvalidArgument().Trace(), "Source "+srcURL+" is not a file.")
fatalIf(errInvalidArgument().Trace(), "Source `"+srcURL+"` is not a file.")
}
}
@@ -96,16 +96,16 @@ func checkCopySyntaxTypeB(srcURLs []string, tgtURL string) {
}
srcURL := srcURLs[0]
_, srcContent, err := url2Stat(srcURL)
fatalIf(err.Trace(srcURL), "Unable to stat source "+srcURL+".")
fatalIf(err.Trace(srcURL), "Unable to stat source `"+srcURL+"`.")
if !srcContent.Type.IsRegular() {
fatalIf(errInvalidArgument().Trace(srcURL), "Source "+srcURL+" is not a file.")
fatalIf(errInvalidArgument().Trace(srcURL), "Source `"+srcURL+"` is not a file.")
}
// Check target.
if _, tgtContent, err := url2Stat(tgtURL); err == nil {
if !tgtContent.Type.IsDir() {
fatalIf(errInvalidArgument().Trace(tgtURL), "Target "+tgtURL+" is not a folder.")
fatalIf(errInvalidArgument().Trace(tgtURL), "Target `"+tgtURL+"` is not a folder.")
}
}
}
@@ -122,7 +122,7 @@ func checkCopySyntaxTypeC(srcURLs []string, tgtURL string, isRecursive bool) {
// incomplete uploads are not necessary for copy operation, no need to verify for them.
isIncomplete := false
if err != nil && !isURLPrefixExists(srcURL, isIncomplete) {
fatalIf(err.Trace(srcURL), "Unable to stat source "+srcURL+".")
fatalIf(err.Trace(srcURL), "Unable to stat source `"+srcURL+"`.")
}
if srcContent.Type.IsDir() && !isRecursive {
@@ -132,7 +132,7 @@ func checkCopySyntaxTypeC(srcURLs []string, tgtURL string, isRecursive bool) {
// Check target.
if _, tgtContent, err := url2Stat(tgtURL); err == nil {
if !tgtContent.Type.IsDir() {
fatalIf(errInvalidArgument().Trace(tgtURL), "Target "+tgtURL+" is not a folder.")
fatalIf(errInvalidArgument().Trace(tgtURL), "Target `"+tgtURL+"` is not a folder.")
}
}
}
@@ -143,7 +143,7 @@ func checkCopySyntaxTypeD(srcURLs []string, tgtURL string) {
// Check target if it is a dir
if _, tgtContent, err := url2Stat(tgtURL); err == nil {
if !tgtContent.Type.IsDir() {
fatalIf(errInvalidArgument().Trace(tgtURL), "Target "+tgtURL+" is not a folder.")
fatalIf(errInvalidArgument().Trace(tgtURL), "Target `"+tgtURL+"` is not a folder.")
}
}
}

View File

@@ -79,19 +79,19 @@ func (d diffMessage) String() string {
switch d.Diff {
case differInFirst:
msg = console.Colorize("DiffMessage",
""+d.FirstURL+"") + console.Colorize("DiffOnlyInFirst", " - only in first.")
"`"+d.FirstURL+"`") + console.Colorize("DiffOnlyInFirst", " - only in first.")
case differInSecond:
msg = console.Colorize("DiffMessage",
""+d.SecondURL+"") + console.Colorize("DiffOnlyInSecond", " - only in second.")
"`"+d.SecondURL+"`") + console.Colorize("DiffOnlyInSecond", " - only in second.")
case differInType:
msg = console.Colorize("DiffMessage",
""+d.FirstURL+""+" and "+""+d.SecondURL+"") + console.Colorize("DiffType", " - differ in type.")
"`"+d.FirstURL+"`"+" and "+"`"+d.SecondURL+"`") + console.Colorize("DiffType", " - differ in type.")
case differInSize:
msg = console.Colorize("DiffMessage",
""+d.FirstURL+""+" and "+""+d.SecondURL+"") + console.Colorize("DiffSize", " - differ in size.")
"`"+d.FirstURL+"`"+" and "+"`"+d.SecondURL+"`") + console.Colorize("DiffSize", " - differ in size.")
default:
fatalIf(errDummy().Trace(d.FirstURL, d.SecondURL),
"Unhandled difference between "+d.FirstURL+" and "+d.SecondURL+".")
"Unhandled difference between `"+d.FirstURL+"` and `"+d.SecondURL+"`.")
}
return msg
@@ -102,7 +102,7 @@ func (d diffMessage) JSON() string {
d.Status = "success"
diffJSONBytes, e := json.Marshal(d)
fatalIf(probe.NewError(e),
"Unable to marshal diff message "+d.FirstURL+", "+d.SecondURL+" and "+string(d.Diff)+".")
"Unable to marshal diff message `"+d.FirstURL+"`, `"+d.SecondURL+"` and `"+string(d.Diff)+"`.")
return string(diffJSONBytes)
}
@@ -129,7 +129,7 @@ func checkDiffSyntax(ctx *cli.Context) {
// Verify if its a directory.
if !firstContent.Type.IsDir() {
fatalIf(errInvalidArgument().Trace(firstURL), fmt.Sprintf("%s is not a folder.", firstURL))
fatalIf(errInvalidArgument().Trace(firstURL), fmt.Sprintf("`%s` is not a folder.", firstURL))
}
// Verify if secondURL is accessible.
@@ -140,7 +140,7 @@ func checkDiffSyntax(ctx *cli.Context) {
// Verify if its a directory.
if !secondContent.Type.IsDir() {
fatalIf(errInvalidArgument().Trace(secondURL), fmt.Sprintf("%s is not a folder.", secondURL))
fatalIf(errInvalidArgument().Trace(secondURL), fmt.Sprintf("`%s` is not a folder.", secondURL))
}
}

View File

@@ -99,7 +99,7 @@ func checkListSyntax(ctx *cli.Context) {
if _, ok := err.ToGoError().(BucketNameEmpty); ok {
continue
}
fatalIf(err.Trace(url), "Unable to stat "+url+".")
fatalIf(err.Trace(url), "Unable to stat `"+url+"`.")
}
}
}
@@ -129,7 +129,7 @@ func mainList(ctx *cli.Context) error {
for _, targetURL := range args {
var clnt Client
clnt, err := newClient(targetURL)
fatalIf(err.Trace(targetURL), "Unable to initialize target "+targetURL+".")
fatalIf(err.Trace(targetURL), "Unable to initialize target `"+targetURL+"`.")
var st *clientContent
if st, err = clnt.Stat(isIncomplete); err != nil {
@@ -138,14 +138,14 @@ func mainList(ctx *cli.Context) error {
// For aliases like ``mc ls s3`` it's acceptable to receive BucketNameEmpty error.
// Nothing to do.
default:
fatalIf(err.Trace(targetURL), "Unable to initialize target "+targetURL+".")
fatalIf(err.Trace(targetURL), "Unable to initialize target `"+targetURL+"`.")
}
} else if st.Type.IsDir() {
if !strings.HasSuffix(targetURL, string(clnt.GetURL().Separator)) {
targetURL = targetURL + string(clnt.GetURL().Separator)
}
clnt, err = newClient(targetURL)
fatalIf(err.Trace(targetURL), "Unable to initialize target "+targetURL+".")
fatalIf(err.Trace(targetURL), "Unable to initialize target `"+targetURL+"`.")
}
if e := doList(clnt, isRecursive, isIncomplete); e != nil {
cErr = e

View File

@@ -92,16 +92,16 @@ func Main() {
// Function invoked when invalid command is passed.
func commandNotFound(ctx *cli.Context, command string) {
msg := fmt.Sprintf("%s is not a mc command. See mc --help.", command)
msg := fmt.Sprintf("`%s` is not a mc command. See `mc --help`.", command)
closestCommands := findClosestCommands(command)
if len(closestCommands) > 0 {
msg += fmt.Sprintf("\n\nDid you mean one of these?\n")
if len(closestCommands) == 1 {
cmd := closestCommands[0]
msg += fmt.Sprintf(" %s", cmd)
msg += fmt.Sprintf(" `%s`", cmd)
} else {
for _, cmd := range closestCommands {
msg += fmt.Sprintf(" %s\n", cmd)
msg += fmt.Sprintf(" `%s`\n", cmd)
}
}
}
@@ -175,7 +175,7 @@ func initMC() {
err := saveMcConfig(newMcConfig())
fatalIf(err.Trace(), "Unable to save new mc config.")
console.Infoln("Configuration written to " + mustGetMcConfigPath() + ". Please update your access credentials.")
console.Infoln("Configuration written to `" + mustGetMcConfigPath() + "`. Please update your access credentials.")
}
// Check if mc session folder exists.

View File

@@ -30,7 +30,7 @@ var (
cli.StringFlag{
Name: "region",
Value: "us-east-1",
Usage: "Specify bucket region. Defaults to us-east-1.",
Usage: "Specify bucket region. Defaults to `us-east-1`.",
},
}
)
@@ -58,13 +58,13 @@ EXAMPLES:
2. Create a new bucket on Google Cloud Storage.
$ {{.HelpName}} gcs/miniocloud
4. Create a new bucket on Amazon S3 cloud storage in region us-west-2.
4. Create a new bucket on Amazon S3 cloud storage in region 'us-west-2'.
$ {{.HelpName}} --region=us-west-2 s3/myregionbucket
5. Create a new directory including its missing parents (equivalent to mkdir -p).
5. Create a new directory including its missing parents (equivalent to 'mkdir -p').
$ {{.HelpName}} /tmp/this/new/dir1
6. Create multiple directories including its missing parents (behavior similar to mkdir -p).
6. Create multiple directories including its missing parents (behavior similar to 'mkdir -p').
$ {{.HelpName}} /mnt/sdb/mydisk /mnt/sdc/mydisk /mnt/sdd/mydisk
`,
@@ -79,7 +79,7 @@ type makeBucketMessage struct {
// String colorized make bucket message.
func (s makeBucketMessage) String() string {
return console.Colorize("MakeBucket", "Bucket created successfully "+s.Bucket+".")
return console.Colorize("MakeBucket", "Bucket created successfully `"+s.Bucket+"`.")
}
// JSON jsonified make bucket message.
@@ -115,7 +115,7 @@ func mainMakeBucket(ctx *cli.Context) error {
// Instantiate client for URL.
clnt, err := newClient(targetURL)
if err != nil {
errorIf(err.Trace(targetURL), "Invalid target "+targetURL+".")
errorIf(err.Trace(targetURL), "Invalid target `"+targetURL+"`.")
cErr = exitStatus(globalErrorExitStatus)
continue
}
@@ -123,7 +123,7 @@ func mainMakeBucket(ctx *cli.Context) error {
// Make bucket.
err = clnt.MakeBucket(region)
if err != nil {
errorIf(err.Trace(targetURL), "Unable to make bucket "+targetURL+".")
errorIf(err.Trace(targetURL), "Unable to make bucket `"+targetURL+"`.")
cErr = exitStatus(globalErrorExitStatus)
continue
}

View File

@@ -154,7 +154,7 @@ type mirrorMessage struct {
// String colorized mirror message
func (m mirrorMessage) String() string {
return console.Colorize("Mirror", fmt.Sprintf("%s -> %s", m.Source, m.Target))
return console.Colorize("Mirror", fmt.Sprintf("`%s` -> `%s`", m.Source, m.Target))
}
// JSON jsonified mirror message
@@ -254,11 +254,11 @@ func (mj *mirrorJob) startStatus() {
// don't print over the ongoing progress bar.
if sURLs.SourceContent != nil {
errorIf(sURLs.Error.Trace(sURLs.SourceContent.URL.String()),
fmt.Sprintf("Failed to copy %s.", sURLs.SourceContent.URL.String()))
fmt.Sprintf("Failed to copy `%s`.", sURLs.SourceContent.URL.String()))
} else {
// When sURLs.SourceContent is nil, we know that we have an error related to removing
errorIf(sURLs.Error.Trace(sURLs.TargetContent.URL.String()),
fmt.Sprintf("Failed to remove %s.", sURLs.TargetContent.URL.String()))
fmt.Sprintf("Failed to remove `%s`.", sURLs.TargetContent.URL.String()))
}
}
@@ -436,7 +436,7 @@ func (mj *mirrorJob) startMirror() {
}
if sURLs.Error != nil {
if strings.Contains(sURLs.Error.ToGoError().Error(), " is a folder.") {
mj.status.errorIf(sURLs.Error.Trace(), "Folder cannot be copied. Please use ... suffix.")
mj.status.errorIf(sURLs.Error.Trace(), "Folder cannot be copied. Please use `...` suffix.")
} else {
mj.status.errorIf(sURLs.Error.Trace(), "Unable to prepare URL for copying.")
}

View File

@@ -45,11 +45,11 @@ func checkMirrorSyntax(ctx *cli.Context) {
// incomplete uploads are not necessary for copy operation, no need to verify for them.
isIncomplete := false
if err != nil && !isURLPrefixExists(srcURL, isIncomplete) {
errorIf(err.Trace(srcURL), "Unable to stat source "+srcURL+".")
errorIf(err.Trace(srcURL), "Unable to stat source `"+srcURL+"`.")
}
if err == nil && !srcContent.Type.IsDir() {
fatalIf(errInvalidArgument().Trace(srcContent.URL.String(), srcContent.Type.String()), fmt.Sprintf("Source %s is not a folder. Only folders are supported by mirror command.", srcURL))
fatalIf(errInvalidArgument().Trace(srcContent.URL.String(), srcContent.Type.String()), fmt.Sprintf("Source `%s` is not a folder. Only folders are supported by mirror command.", srcURL))
}
}
@@ -61,7 +61,7 @@ func checkMirrorSyntax(ctx *cli.Context) {
if url.Host != "" {
if url.Path == string(url.Separator) {
fatalIf(errInvalidArgument().Trace(tgtURL),
fmt.Sprintf("Target %s does not contain bucket name.", tgtURL))
fmt.Sprintf("Target `%s` does not contain bucket name.", tgtURL))
}
}
}

View File

@@ -111,11 +111,11 @@ type policyMessage struct {
func (s policyMessage) String() string {
if s.Operation == "set" {
return console.Colorize("Policy",
"Access permission for "+s.Bucket+" is set to "+string(s.Perms)+"")
"Access permission for `"+s.Bucket+"` is set to `"+string(s.Perms)+"`")
}
if s.Operation == "get" {
return console.Colorize("Policy",
"Access permission for "+s.Bucket+""+" is "+string(s.Perms)+"")
"Access permission for `"+s.Bucket+"`"+" is `"+string(s.Perms)+"`")
}
// nothing to print
return ""
@@ -183,7 +183,7 @@ func checkPolicySyntax(ctx *cli.Context) {
default:
if argsLength == 2 {
fatalIf(errDummy().Trace(),
"Unrecognized permission "+string(firstArg)+". Allowed values are [none, download, upload, public].")
"Unrecognized permission `"+string(firstArg)+"`. Allowed values are [none, download, upload, public].")
}
}
}
@@ -262,9 +262,9 @@ func runPolicyListCmd(ctx *cli.Context) {
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
fatalIf(err.Trace(), "Unable to list policies of a non S3 url "+targetURL+".")
fatalIf(err.Trace(), "Unable to list policies of a non S3 url `"+targetURL+"`.")
default:
fatalIf(err.Trace(targetURL), "Unable to list policies of target "+targetURL+".")
fatalIf(err.Trace(targetURL), "Unable to list policies of target `"+targetURL+"`.")
}
}
for k, v := range policies {
@@ -282,9 +282,9 @@ func runPolicyLinksCmd(ctx *cli.Context) {
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
fatalIf(err.Trace(), "Unable to list policies of a non S3 url "+targetURL+".")
fatalIf(err.Trace(), "Unable to list policies of a non S3 url `"+targetURL+"`.")
default:
fatalIf(err.Trace(targetURL), "Unable to list policies of target "+targetURL+".")
fatalIf(err.Trace(targetURL), "Unable to list policies of target `"+targetURL+"`.")
}
}
@@ -312,7 +312,7 @@ func runPolicyLinksCmd(ctx *cli.Context) {
// Construct the new path to search for public objects
newURL := alias + "/" + policyPath
clnt, err := newClient(newURL)
fatalIf(err.Trace(newURL), "Unable to initialize target "+targetURL+".")
fatalIf(err.Trace(newURL), "Unable to initialize target `"+targetURL+"`.")
// Search for public objects
for content := range clnt.List(isRecursive, isIncomplete, DirFirst) {
if content.Err != nil {
@@ -346,10 +346,10 @@ func runPolicyCmd(ctx *cli.Context) {
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
fatalIf(err.Trace(), "Unable to set policy of a non S3 url "+targetURL+".")
fatalIf(err.Trace(), "Unable to set policy of a non S3 url `"+targetURL+"`.")
default:
fatalIf(err.Trace(targetURL, string(perms)),
"Unable to set policy "+string(perms)+" for "+targetURL+".")
"Unable to set policy `"+string(perms)+"` for `"+targetURL+"`.")
}
}
@@ -366,9 +366,9 @@ func runPolicyCmd(ctx *cli.Context) {
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
fatalIf(err.Trace(), "Unable to get policy of a non S3 url "+targetURL+".")
fatalIf(err.Trace(), "Unable to get policy of a non S3 url `"+targetURL+"`.")
default:
fatalIf(err.Trace(targetURL), "Unable to get policy for "+targetURL+".")
fatalIf(err.Trace(targetURL), "Unable to get policy for `"+targetURL+"`.")
}
}

View File

@@ -105,7 +105,7 @@ type rmMessage struct {
// Colorized message for console printing.
func (r rmMessage) String() string {
return console.Colorize("Remove", fmt.Sprintf("Removing %s.", r.Key))
return console.Colorize("Remove", fmt.Sprintf("Removing `%s`.", r.Key))
}
// JSON'ified message for scripting.
@@ -138,13 +138,13 @@ func removeSingle(url string, isIncomplete bool, isFake bool, older int) error {
targetAlias, targetURL, _ := mustExpandAlias(url)
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
if pErr != nil {
errorIf(pErr.Trace(url), "Invalid argument "+url+".")
errorIf(pErr.Trace(url), "Invalid argument `"+url+"`.")
return exitStatus(globalErrorExitStatus) // End of journey.
}
content, pErr := clnt.Stat(isIncomplete)
if pErr != nil {
errorIf(pErr.Trace(url), "Failed to remove "+url+".")
errorIf(pErr.Trace(url), "Failed to remove `"+url+"`.")
return exitStatus(globalErrorExitStatus)
}
if older > 0 {
@@ -170,7 +170,7 @@ func removeSingle(url string, isIncomplete bool, isFake bool, older int) error {
errorCh := clnt.Remove(isIncomplete, contentCh)
for pErr := range errorCh {
if pErr != nil {
errorIf(pErr.Trace(url), "Failed to remove "+url+".")
errorIf(pErr.Trace(url), "Failed to remove `"+url+"`.")
switch pErr.ToGoError().(type) {
case PathInsufficientPermission:
// Ignore Permission error.
@@ -187,7 +187,7 @@ func removeRecursive(url string, isIncomplete bool, isFake bool, older int) erro
targetAlias, targetURL, _ := mustExpandAlias(url)
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
if pErr != nil {
errorIf(pErr.Trace(url), "Failed to remove "+url+" recursively.")
errorIf(pErr.Trace(url), "Failed to remove `"+url+"` recursively.")
return exitStatus(globalErrorExitStatus) // End of journey.
}
@@ -199,7 +199,7 @@ func removeRecursive(url string, isIncomplete bool, isFake bool, older int) erro
for content := range clnt.List(isRecursive, isIncomplete, DirLast) {
isEmpty = false
if content.Err != nil {
errorIf(content.Err.Trace(url), "Failed to remove "+url+" recursively.")
errorIf(content.Err.Trace(url), "Failed to remove `"+url+"` recursively.")
switch content.Err.ToGoError().(type) {
case PathInsufficientPermission:
// Ignore Permission error.
@@ -232,7 +232,7 @@ func removeRecursive(url string, isIncomplete bool, isFake bool, older int) erro
case contentCh <- content:
sent = true
case pErr := <-errorCh:
errorIf(pErr.Trace(urlString), "Failed to remove "+urlString+".")
errorIf(pErr.Trace(urlString), "Failed to remove `"+urlString+"`.")
switch pErr.ToGoError().(type) {
case PathInsufficientPermission:
// Ignore Permission error.
@@ -248,7 +248,7 @@ func removeRecursive(url string, isIncomplete bool, isFake bool, older int) erro
close(contentCh)
for pErr := range errorCh {
errorIf(pErr.Trace(url), "Failed to remove "+url+" recursively.")
errorIf(pErr.Trace(url), "Failed to remove `"+url+"` recursively.")
switch pErr.ToGoError().(type) {
case PathInsufficientPermission:
// Ignore Permission error.

View File

@@ -108,7 +108,7 @@ type clearSessionMessage struct {
// String colorized clear session message.
func (c clearSessionMessage) String() string {
msg := "Session " + c.SessionID + ""
msg := "Session `" + c.SessionID + "`"
var colorizedMsg string
switch c.Status {
case "success":
@@ -132,9 +132,9 @@ func clearSession(sid string) {
if sid == "all" {
for _, sid := range getSessionIDs() {
session, err := loadSessionV8(sid)
fatalIf(err.Trace(sid), "Unable to load session "+sid+".")
fatalIf(err.Trace(sid), "Unable to load session `"+sid+"`.")
fatalIf(session.Delete().Trace(sid), "Unable to load session "+sid+".")
fatalIf(session.Delete().Trace(sid), "Unable to load session `"+sid+"`.")
printMsg(clearSessionMessage{Status: "success", SessionID: sid})
}
@@ -142,7 +142,7 @@ func clearSession(sid string) {
}
if !isSessionExists(sid) {
fatalIf(errDummy().Trace(sid), "Session "+sid+" not found.")
fatalIf(errDummy().Trace(sid), "Session `"+sid+"` not found.")
}
session, err := loadSessionV8(sid)
@@ -156,7 +156,7 @@ func clearSession(sid string) {
}
if session != nil {
fatalIf(session.Delete().Trace(sid), "Unable to load session "+sid+".")
fatalIf(session.Delete().Trace(sid), "Unable to load session `"+sid+"`.")
printMsg(clearSessionMessage{Status: "success", SessionID: sid})
}
}
@@ -228,11 +228,11 @@ func mainSession(ctx *cli.Context) error {
sid := strings.TrimSpace(ctx.Args().Tail().First())
if !isSessionExists(sid) {
closestSessions := findClosestSessions(sid)
errorMsg := "Session " + sid + " not found."
errorMsg := "Session `" + sid + "` not found."
if len(closestSessions) > 0 {
errorMsg += fmt.Sprintf("\n\nDid you mean?\n")
for _, session := range closestSessions {
errorMsg += fmt.Sprintf(" mc resume session %s", session)
errorMsg += fmt.Sprintf(" `mc resume session %s`", session)
// break on the first one, it is good enough.
break
}
@@ -262,7 +262,7 @@ func mainSession(ctx *cli.Context) error {
// change folder back to saved path.
e = os.Chdir(savedCwd)
fatalIf(probe.NewError(e), "Unable to change working folder to saved path "+savedCwd+".")
fatalIf(probe.NewError(e), "Unable to change working folder to saved path `"+savedCwd+"`.")
// purge a requested pending session, if "all" purge everything.
case "clear":
clearSession(strings.TrimSpace(ctx.Args().Tail().First()))

View File

@@ -34,11 +34,11 @@ func migrateSessionV7ToV8() {
if os.IsNotExist(err.ToGoError()) {
continue
}
fatalIf(err.Trace(sid), "Unable to load version 7. Migration failed please report this issue at https://github.com/minio/mc/issues.")
fatalIf(err.Trace(sid), "Unable to load version `7`. Migration failed please report this issue at https://github.com/minio/mc/issues.")
}
sessionVersion, e := strconv.Atoi(sV7.Header.Version)
fatalIf(probe.NewError(e), "Unable to load version 7. Migration failed please report this issue at https://github.com/minio/mc/issues.")
fatalIf(probe.NewError(e), "Unable to load version `7`. Migration failed please report this issue at https://github.com/minio/mc/issues.")
if sessionVersion > 7 { // It is new format.
continue
}
@@ -73,7 +73,7 @@ func migrateSessionV7ToV8() {
e = qs.Save(sessionFile)
fatalIf(probe.NewError(e).Trace(sid, sessionFile), "Unable to migrate session from '7' to '8'.")
console.Println("Successfully migrated " + sessionFile + " from version " + sV7.Header.Version + " to " + "" + sV8Header.Version + ".")
console.Println("Successfully migrated `" + sessionFile + "` from version `" + sV7.Header.Version + "` to " + "`" + sV8Header.Version + "`.")
}
}
@@ -86,11 +86,11 @@ func migrateSessionV6ToV7() {
if os.IsNotExist(err.ToGoError()) {
continue
}
fatalIf(err.Trace(sid), "Unable to load version 6. Migration failed please report this issue at https://github.com/minio/mc/issues.")
fatalIf(err.Trace(sid), "Unable to load version `6`. Migration failed please report this issue at https://github.com/minio/mc/issues.")
}
sessionVersion, e := strconv.Atoi(sV6Header.Version)
fatalIf(probe.NewError(e), "Unable to load version 6. Migration failed please report this issue at https://github.com/minio/mc/issues.")
fatalIf(probe.NewError(e), "Unable to load version `6`. Migration failed please report this issue at https://github.com/minio/mc/issues.")
if sessionVersion > 6 { // It is new format.
continue
}
@@ -122,7 +122,7 @@ func migrateSessionV6ToV7() {
e = qs.Save(sessionFile)
fatalIf(probe.NewError(e).Trace(sid, sessionFile), "Unable to migrate session from '6' to '7'.")
console.Println("Successfully migrated " + sessionFile + " from version " + sV6Header.Version + " to " + "" + sV7Header.Version + ".")
console.Println("Successfully migrated `" + sessionFile + "` from version `" + sV6Header.Version + "` to " + "`" + sV7Header.Version + "`.")
}
}
@@ -136,11 +136,11 @@ func migrateSessionV5ToV6() {
if os.IsNotExist(err.ToGoError()) {
continue
}
fatalIf(err.Trace(sid), "Unable to load version 6. Migration failed please report this issue at https://github.com/minio/mc/issues.")
fatalIf(err.Trace(sid), "Unable to load version `6`. Migration failed please report this issue at https://github.com/minio/mc/issues.")
}
sessionVersion, e := strconv.Atoi(sV6Header.Version)
fatalIf(probe.NewError(e), "Unable to load version 6. Migration failed please report this issue at https://github.com/minio/mc/issues.")
fatalIf(probe.NewError(e), "Unable to load version `6`. Migration failed please report this issue at https://github.com/minio/mc/issues.")
if sessionVersion > 5 { // It is new format.
continue
}
@@ -153,12 +153,12 @@ func migrateSessionV5ToV6() {
sessionDataFile, err := getSessionDataFile(sid)
fatalIf(err.Trace(sid), "Unable to get session data file.")
console.Println("Removing unsupported session file " + sessionFile + " version " + sV6Header.Version + ".")
console.Println("Removing unsupported session file `" + sessionFile + "` version `" + sV6Header.Version + "`.")
if e := os.Remove(sessionFile); e != nil {
fatalIf(probe.NewError(e), "Unable to remove version "+sV6Header.Version+" session file "+sessionFile+".")
fatalIf(probe.NewError(e), "Unable to remove version `"+sV6Header.Version+"` session file `"+sessionFile+"`.")
}
if e := os.Remove(sessionDataFile); e != nil {
fatalIf(probe.NewError(e), "Unable to remove version "+sV6Header.Version+" session data file "+sessionDataFile+".")
fatalIf(probe.NewError(e), "Unable to remove version `"+sV6Header.Version+"` session data file `"+sessionDataFile+"`.")
}
}
}

View File

@@ -371,7 +371,7 @@ func (s *sessionV8) Delete() *probe.Error {
// Close a session and exit.
func (s sessionV8) CloseAndDie() {
s.Close()
console.Fatalln("Session safely terminated. To resume session mc session resume " + s.SessionID + "")
console.Fatalln("Session safely terminated. To resume session `mc session resume " + s.SessionID + "`")
}
// Create a factory function to simplify checking if

View File

@@ -85,7 +85,7 @@ func getSessionFile(sid string) (string, *probe.Error) {
// isSessionExists verifies if given session exists.
func isSessionExists(sid string) bool {
sessionFile, err := getSessionFile(sid)
fatalIf(err.Trace(sid), "Unable to determine session filename for "+sid+".")
fatalIf(err.Trace(sid), "Unable to determine session filename for `"+sid+"`.")
if _, e := os.Stat(sessionFile); e != nil {
return false
@@ -111,7 +111,7 @@ func getSessionIDs() (sids []string) {
fatalIf(err.Trace(), "Unable to access session folder.")
sessionList, e := filepath.Glob(sessionDir + "/*.json")
fatalIf(probe.NewError(e), "Unable to access session folder "+sessionDir+".")
fatalIf(probe.NewError(e), "Unable to access session folder `"+sessionDir+"`.")
for _, path := range sessionList {
sids = append(sids, strings.TrimSuffix(filepath.Base(path), ".json"))

View File

@@ -78,7 +78,7 @@ func checkShareDownloadSyntax(ctx *cli.Context) {
if expireArg != "" {
var e error
expiry, e = time.ParseDuration(expireArg)
fatalIf(probe.NewError(e), "Unable to parse expire="+expireArg+".")
fatalIf(probe.NewError(e), "Unable to parse expire=`"+expireArg+"`.")
}
// Validate expiry.
@@ -91,7 +91,7 @@ func checkShareDownloadSyntax(ctx *cli.Context) {
for _, url := range ctx.Args() {
_, _, err := url2Stat(url)
fatalIf(err.Trace(url), "Unable to stat "+url+".")
fatalIf(err.Trace(url), "Unable to stat `"+url+"`.")
}
}
@@ -170,7 +170,7 @@ func mainShareDownload(ctx *cli.Context) error {
if ctx.String("expire") != "" {
var e error
expiry, e = time.ParseDuration(ctx.String("expire"))
fatalIf(probe.NewError(e), "Unable to parse expire="+ctx.String("expire")+".")
fatalIf(probe.NewError(e), "Unable to parse expire=`"+ctx.String("expire")+"`.")
}
for _, targetURL := range ctx.Args() {
@@ -178,9 +178,9 @@ func mainShareDownload(ctx *cli.Context) error {
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
fatalIf(err.Trace(), "Unable to share a non S3 url "+targetURL+".")
fatalIf(err.Trace(), "Unable to share a non S3 url `"+targetURL+"`.")
default:
fatalIf(err.Trace(targetURL), "Unable to share target "+targetURL+".")
fatalIf(err.Trace(targetURL), "Unable to share target `"+targetURL+"`.")
}
}
}

View File

@@ -65,7 +65,7 @@ func checkShareListSyntax(ctx *cli.Context) {
// doShareList list shared url's.
func doShareList(cmd string) *probe.Error {
if cmd != "upload" && cmd != "download" {
return probe.NewError(fmt.Errorf("Unknown argument %s passed", cmd))
return probe.NewError(fmt.Errorf("Unknown argument `%s` passed", cmd))
}
// Fetch defaults.

View File

@@ -67,8 +67,8 @@ func migrateShare() {
if _, e := os.Stat(oldShareFile); e == nil {
// Old file exits.
e := os.Remove(oldShareFile)
fatalIf(probe.NewError(e), "Unable to delete old "+oldShareFile+".")
console.Infof("Removed older version of share %s file.\n", oldShareFile)
fatalIf(probe.NewError(e), "Unable to delete old `"+oldShareFile+"`.")
console.Infof("Removed older version of share `%s` file.\n", oldShareFile)
}
}

View File

@@ -39,7 +39,7 @@ var (
// Share documents via URL.
var shareUpload = cli.Command{
Name: "upload",
Usage: "Generate curl command to upload objects without requiring access/secret keys.",
Usage: "Generate `curl` command to upload objects without requiring access/secret keys.",
Action: mainShareUpload,
Before: setGlobalsFromContext,
Flags: append(shareUploadFlags, globalFlags...),
@@ -84,7 +84,7 @@ func checkShareUploadSyntax(ctx *cli.Context) {
if expireArg != "" {
var e error
expiry, e = time.ParseDuration(expireArg)
fatalIf(probe.NewError(e), "Unable to parse expire="+expireArg+".")
fatalIf(probe.NewError(e), "Unable to parse expire=`"+expireArg+"`.")
}
// Validate expiry.
@@ -195,7 +195,7 @@ func mainShareUpload(ctx *cli.Context) error {
if expireArg != "" {
var e error
expiry, e = time.ParseDuration(expireArg)
fatalIf(probe.NewError(e), "Unable to parse expire="+expireArg+".")
fatalIf(probe.NewError(e), "Unable to parse expire=`"+expireArg+"`.")
}
for _, targetURL := range ctx.Args() {
@@ -203,9 +203,9 @@ func mainShareUpload(ctx *cli.Context) error {
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
fatalIf(err.Trace(), "Unable to share a non S3 url "+targetURL+".")
fatalIf(err.Trace(), "Unable to share a non S3 url `"+targetURL+"`.")
default:
fatalIf(err.Trace(targetURL), "Unable to generate curl command for upload "+targetURL+".")
fatalIf(err.Trace(targetURL), "Unable to generate curl command for upload `"+targetURL+"`.")
}
}
}

View File

@@ -113,7 +113,7 @@ func getShareDir() (string, *probe.Error) {
return sharedURLsDataDir, nil
}
// Get share dir name or die. (NOTE: This Die approach is only OK for mc like tools.).
// Get share dir name or die. (NOTE: This `Die` approach is only OK for mc like tools.).
func mustGetShareDir() string {
shareDir, err := getShareDir()
fatalIf(err.Trace(), "Unable to determine share folder.")
@@ -177,21 +177,21 @@ func initShareConfig() {
// Share directory.
if !isShareDirExists() {
fatalIf(createShareDir().Trace(mustGetShareDir()),
"Failed to create share "+mustGetShareDir()+" folder.")
console.Infof("Successfully created %s.\n", mustGetShareDir())
"Failed to create share `"+mustGetShareDir()+"` folder.")
console.Infof("Successfully created `%s`.\n", mustGetShareDir())
}
// Uploads share file.
if !isShareUploadsExists() {
fatalIf(initShareUploadsFile().Trace(getShareUploadsFile()),
"Failed to initialize share uploads "+getShareUploadsFile()+" file.")
console.Infof("Initialized share uploads %s file.\n", getShareUploadsFile())
"Failed to initialize share uploads `"+getShareUploadsFile()+"` file.")
console.Infof("Initialized share uploads `%s` file.\n", getShareUploadsFile())
}
// Downloads share file.
if !isShareDownloadsExists() {
fatalIf(initShareDownloadsFile().Trace(getShareDownloadsFile()),
"Failed to initialize share downloads "+getShareDownloadsFile()+" file.")
console.Infof("Initialized share downloads %s file.\n", getShareDownloadsFile())
"Failed to initialize share downloads `"+getShareDownloadsFile()+"` file.")
console.Infof("Initialized share downloads `%s` file.\n", getShareDownloadsFile())
}
}

View File

@@ -36,30 +36,30 @@ var (
}
errInvalidAliasedURL = func(URL string) *probe.Error {
return probe.NewError(errors.New("Use mc config host add mycloud " + URL + " ... to add an alias. Use the alias for S3 operations.")).Untrace()
return probe.NewError(errors.New("Use `mc config host add mycloud " + URL + " ...` to add an alias. Use the alias for S3 operations.")).Untrace()
}
errNoMatchingHost = func(URL string) *probe.Error {
return probe.NewError(errors.New("No matching host found for the given URL " + URL + ".")).Untrace()
return probe.NewError(errors.New("No matching host found for the given URL `" + URL + "`.")).Untrace()
}
errInvalidSource = func(URL string) *probe.Error {
return probe.NewError(errors.New("Invalid source " + URL + ".")).Untrace()
return probe.NewError(errors.New("Invalid source `" + URL + "`.")).Untrace()
}
errInvalidTarget = func(URL string) *probe.Error {
return probe.NewError(errors.New("Invalid target " + URL + ".")).Untrace()
return probe.NewError(errors.New("Invalid target `" + URL + "`.")).Untrace()
}
errOverWriteNotAllowed = func(URL string) *probe.Error {
return probe.NewError(errors.New("Overwrite not allowed for " + URL + ". Use --force to override this behavior."))
return probe.NewError(errors.New("Overwrite not allowed for `" + URL + "`. Use `--force` to override this behavior."))
}
errDeleteNotAllowed = func(URL string) *probe.Error {
return probe.NewError(errors.New("Delete not allowed for " + URL + ". Use --force to override this behavior."))
return probe.NewError(errors.New("Delete not allowed for `" + URL + "`. Use `--force` to override this behavior."))
}
errSourceIsDir = func(URL string) *probe.Error {
return probe.NewError(errors.New("Source " + URL + " is a folder.")).Untrace()
return probe.NewError(errors.New("Source `" + URL + "` is a folder.")).Untrace()
}
errSourceTargetSame = func(URL string) *probe.Error {

View File

@@ -77,7 +77,7 @@ type updateMessage struct {
// String colorized update message.
func (u updateMessage) String() string {
if u.olderThan == time.Duration(0) {
return console.Colorize("Update", "You are already running the most recent version of mc.")
return console.Colorize("Update", "You are already running the most recent version of `mc`.")
}
return colorizeUpdateMessage(u.Download, u.olderThan)
}