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:
committed by
Harshavardhana
parent
2ca601ef22
commit
798775775b
@@ -55,7 +55,7 @@ type serviceRestartMessage struct {
|
|||||||
|
|
||||||
// String colorized make bucket message.
|
// String colorized make bucket message.
|
||||||
func (s serviceRestartMessage) String() string {
|
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.
|
// JSON jsonified make bucket message.
|
||||||
|
@@ -69,7 +69,7 @@ func checkCatSyntax(ctx *cli.Context) {
|
|||||||
}
|
}
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
if strings.HasPrefix(arg, "-") && len(arg) > 1 {
|
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
|
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())
|
args := []string(ctx.Args())
|
||||||
if ctx.Args().First() == "-" {
|
if ctx.Args().First() == "-" {
|
||||||
for i, arg := range os.Args {
|
for i, arg := range os.Args {
|
||||||
@@ -165,7 +165,7 @@ func mainCat(ctx *cli.Context) error {
|
|||||||
|
|
||||||
// Convert arguments to URLs: expand alias, fix format.
|
// Convert arguments to URLs: expand alias, fix format.
|
||||||
for _, url := range args {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ type APINotImplemented struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e APINotImplemented) Error() string {
|
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
|
// GenericBucketError - generic bucket operations error
|
||||||
@@ -39,14 +39,14 @@ type GenericBucketError struct {
|
|||||||
type BucketDoesNotExist GenericBucketError
|
type BucketDoesNotExist GenericBucketError
|
||||||
|
|
||||||
func (e BucketDoesNotExist) Error() string {
|
func (e BucketDoesNotExist) Error() string {
|
||||||
return "Bucket ‘" + e.Bucket + "’ does not exist."
|
return "Bucket `" + e.Bucket + "` does not exist."
|
||||||
}
|
}
|
||||||
|
|
||||||
// BucketExists - bucket exists.
|
// BucketExists - bucket exists.
|
||||||
type BucketExists GenericBucketError
|
type BucketExists GenericBucketError
|
||||||
|
|
||||||
func (e BucketExists) Error() string {
|
func (e BucketExists) Error() string {
|
||||||
return "Bucket ‘" + e.Bucket + "’ exists."
|
return "Bucket `" + e.Bucket + "` exists."
|
||||||
}
|
}
|
||||||
|
|
||||||
// BucketNameEmpty - bucket name empty (http://goo.gl/wJlzDz)
|
// BucketNameEmpty - bucket name empty (http://goo.gl/wJlzDz)
|
||||||
@@ -71,7 +71,7 @@ type ObjectAlreadyExists struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e ObjectAlreadyExists) Error() string {
|
func (e ObjectAlreadyExists) Error() string {
|
||||||
return "Object ‘" + e.Object + "’ already exists."
|
return "Object `" + e.Object + "` already exists."
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectAlreadyExistsAsDirectory - typed return for XMinioObjectExistsAsDirectory
|
// ObjectAlreadyExistsAsDirectory - typed return for XMinioObjectExistsAsDirectory
|
||||||
@@ -80,7 +80,7 @@ type ObjectAlreadyExistsAsDirectory struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e ObjectAlreadyExistsAsDirectory) Error() string {
|
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.
|
// ObjectOnGlacier - object is of storage class glacier.
|
||||||
@@ -89,7 +89,7 @@ type ObjectOnGlacier struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e ObjectOnGlacier) Error() string {
|
func (e ObjectOnGlacier) Error() string {
|
||||||
return "Object ‘" + e.Object + "’ is on Glacier storage."
|
return "Object `" + e.Object + "` is on Glacier storage."
|
||||||
}
|
}
|
||||||
|
|
||||||
// BucketNameTopLevel - generic error
|
// BucketNameTopLevel - generic error
|
||||||
@@ -108,35 +108,35 @@ type GenericFileError struct {
|
|||||||
type PathNotFound GenericFileError
|
type PathNotFound GenericFileError
|
||||||
|
|
||||||
func (e PathNotFound) Error() string {
|
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.
|
// PathIsNotRegular (ENOTREG) - file is not a regular file.
|
||||||
type PathIsNotRegular GenericFileError
|
type PathIsNotRegular GenericFileError
|
||||||
|
|
||||||
func (e PathIsNotRegular) Error() string {
|
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.
|
// PathInsufficientPermission (EPERM) - permission denied.
|
||||||
type PathInsufficientPermission GenericFileError
|
type PathInsufficientPermission GenericFileError
|
||||||
|
|
||||||
func (e PathInsufficientPermission) Error() string {
|
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.
|
// BrokenSymlink (ENOTENT) - file has broken symlink.
|
||||||
type BrokenSymlink GenericFileError
|
type BrokenSymlink GenericFileError
|
||||||
|
|
||||||
func (e BrokenSymlink) Error() string {
|
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.
|
// TooManyLevelsSymlink (ELOOP) - file has too many levels of symlinks.
|
||||||
type TooManyLevelsSymlink GenericFileError
|
type TooManyLevelsSymlink GenericFileError
|
||||||
|
|
||||||
func (e TooManyLevelsSymlink) Error() string {
|
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.
|
// EmptyPath (EINVAL) - invalid argument.
|
||||||
@@ -160,7 +160,7 @@ type UnexpectedShortWrite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e UnexpectedShortWrite) Error() string {
|
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
|
return msg
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ type UnexpectedEOF struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e UnexpectedEOF) Error() string {
|
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
|
return msg
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,6 +179,6 @@ func (e UnexpectedEOF) Error() string {
|
|||||||
type UnexpectedExcessRead UnexpectedEOF
|
type UnexpectedExcessRead UnexpectedEOF
|
||||||
|
|
||||||
func (e UnexpectedExcessRead) Error() string {
|
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
|
return msg
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,7 @@ func (s *TestSuite) TestURLJoinPath(c *C) {
|
|||||||
url = urlJoinPath(url1, url2)
|
url = urlJoinPath(url1, url2)
|
||||||
c.Assert(url, Equals, "http://s3.mycompany.io/dev/mybucket/bin/zgrep")
|
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"
|
url1 = "http://s3.mycompany.io/dev"
|
||||||
url2 = "mybucket/bin/"
|
url2 = "mybucket/bin/"
|
||||||
url = urlJoinPath(url1, url2)
|
url = urlJoinPath(url1, url2)
|
||||||
|
@@ -60,7 +60,7 @@ func newBrokenConfigV3() *brokenConfigV3 {
|
|||||||
return conf
|
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
|
// proper hostConfig JSON tags. They may also contain unused ACL and
|
||||||
// Access fields. Rewrite the hostConfig with proper fields using JSON
|
// Access fields. Rewrite the hostConfig with proper fields using JSON
|
||||||
// tags and drop the unused (ACL, Access) fields.
|
// tags and drop the unused (ACL, Access) fields.
|
||||||
@@ -102,12 +102,12 @@ func fixConfigV3() {
|
|||||||
|
|
||||||
if isMutated {
|
if isMutated {
|
||||||
mcNewConfigV3, e := quick.New(cfgV3)
|
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())
|
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 {
|
if isMutated {
|
||||||
// Save the new config back to the disk.
|
// Save the new config back to the disk.
|
||||||
mcCfgV6, e := quick.New(newCfgV6)
|
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())
|
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 {
|
for host, hostCfg := range config.Data().(*configV6).Hosts {
|
||||||
if strings.Contains(host, "*") {
|
if strings.Contains(host, "*") {
|
||||||
fatalIf(errInvalidArgument(),
|
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*") {
|
if strings.Contains(host, "*s3*") || strings.Contains(host, "*.s3*") {
|
||||||
console.Infoln("Found glob url, replacing " + host + " with s3.amazonaws.com")
|
console.Infoln("Found glob url, replacing " + host + " with s3.amazonaws.com")
|
||||||
@@ -237,6 +237,6 @@ func fixConfigV6() {
|
|||||||
|
|
||||||
e = newConf.Save(mustGetMcConfigPath())
|
e = newConf.Save(mustGetMcConfigPath())
|
||||||
fatalIf(probe.NewError(e).Trace(mustGetMcConfigPath()), "Unable to save newly fixed config path.")
|
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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -98,9 +98,9 @@ func (h hostMessage) String() string {
|
|||||||
}
|
}
|
||||||
return message
|
return message
|
||||||
case "remove":
|
case "remove":
|
||||||
return console.Colorize("HostMessage", "Removed ‘"+h.Alias+"’ successfully.")
|
return console.Colorize("HostMessage", "Removed `"+h.Alias+"` successfully.")
|
||||||
case "add":
|
case "add":
|
||||||
return console.Colorize("HostMessage", "Added ‘"+h.Alias+"’ successfully.")
|
return console.Colorize("HostMessage", "Added `"+h.Alias+"` successfully.")
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -149,27 +149,27 @@ func checkConfigHostAddSyntax(ctx *cli.Context) {
|
|||||||
api := tailArgs.Get(4)
|
api := tailArgs.Get(4)
|
||||||
|
|
||||||
if !isValidAlias(alias) {
|
if !isValidAlias(alias) {
|
||||||
fatalIf(errDummy().Trace(alias), "Invalid alias ‘"+alias+"’.")
|
fatalIf(errDummy().Trace(alias), "Invalid alias `"+alias+"`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isValidHostURL(url) {
|
if !isValidHostURL(url) {
|
||||||
fatalIf(errDummy().Trace(url),
|
fatalIf(errDummy().Trace(url),
|
||||||
"Invalid URL ‘"+url+"’.")
|
"Invalid URL `"+url+"`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isValidAccessKey(accessKey) {
|
if !isValidAccessKey(accessKey) {
|
||||||
fatalIf(errInvalidArgument().Trace(accessKey),
|
fatalIf(errInvalidArgument().Trace(accessKey),
|
||||||
"Invalid access key ‘"+accessKey+"’.")
|
"Invalid access key `"+accessKey+"`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isValidSecretKey(secretKey) {
|
if !isValidSecretKey(secretKey) {
|
||||||
fatalIf(errInvalidArgument().Trace(secretKey),
|
fatalIf(errInvalidArgument().Trace(secretKey),
|
||||||
"Invalid secret key ‘"+secretKey+"’.")
|
"Invalid secret key `"+secretKey+"`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if api != "" && !isValidAPI(api) { // Empty value set to default "S3v4".
|
if api != "" && !isValidAPI(api) { // Empty value set to default "S3v4".
|
||||||
fatalIf(errInvalidArgument().Trace(api),
|
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)) {
|
if !isValidAlias(tailArgs.Get(0)) {
|
||||||
fatalIf(errDummy().Trace(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.
|
// addHost - add a host config.
|
||||||
func addHost(alias string, hostCfgV8 hostConfigV8) {
|
func addHost(alias string, hostCfgV8 hostConfigV8) {
|
||||||
mcCfgV8, err := loadMcConfig()
|
mcCfgV8, err := loadMcConfig()
|
||||||
fatalIf(err.Trace(globalMCConfigVersion), "Unable to load config ‘"+mustGetMcConfigPath()+"’.")
|
fatalIf(err.Trace(globalMCConfigVersion), "Unable to load config `"+mustGetMcConfigPath()+"`.")
|
||||||
|
|
||||||
// Add new host.
|
// Add new host.
|
||||||
mcCfgV8.Hosts[alias] = hostCfgV8
|
mcCfgV8.Hosts[alias] = hostCfgV8
|
||||||
|
|
||||||
err = saveMcConfig(mcCfgV8)
|
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{
|
printMsg(hostMessage{
|
||||||
op: "add",
|
op: "add",
|
||||||
@@ -255,13 +255,13 @@ func addHost(alias string, hostCfgV8 hostConfigV8) {
|
|||||||
// removeHost - removes a host.
|
// removeHost - removes a host.
|
||||||
func removeHost(alias string) {
|
func removeHost(alias string) {
|
||||||
conf, err := loadMcConfig()
|
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.
|
// Remove host.
|
||||||
delete(conf.Hosts, alias)
|
delete(conf.Hosts, alias)
|
||||||
|
|
||||||
err = saveMcConfig(conf)
|
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})
|
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.
|
// listHosts - list all host URLs.
|
||||||
func listHosts() {
|
func listHosts() {
|
||||||
conf, err := loadMcConfig()
|
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
|
var maxAlias = 0
|
||||||
for k := range conf.Hosts {
|
for k := range conf.Hosts {
|
||||||
|
@@ -51,7 +51,7 @@ func migrateConfigV1ToV101() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
mcCfgV1, e := quick.Load(mustGetMcConfigPath(), newConfigV1())
|
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 loaded config version does not match 1.0.0, we do nothing.
|
||||||
if mcCfgV1.Version() != "1.0.0" {
|
if mcCfgV1.Version() != "1.0.0" {
|
||||||
@@ -95,20 +95,20 @@ func migrateConfigV1ToV101() {
|
|||||||
|
|
||||||
// Save the new config back to the disk.
|
// Save the new config back to the disk.
|
||||||
mcCfgV101, e := quick.New(cfgV101)
|
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())
|
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() {
|
func migrateConfigV101ToV2() {
|
||||||
if !isMcConfigExists() {
|
if !isMcConfigExists() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
mcCfgV101, e := quick.Load(mustGetMcConfigPath(), newConfigV101())
|
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
|
// update to newer version
|
||||||
if mcCfgV101.Version() != "1.0.1" {
|
if mcCfgV101.Version() != "1.0.1" {
|
||||||
@@ -131,15 +131,15 @@ func migrateConfigV101ToV2() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mcCfgV2, e := quick.New(cfgV2)
|
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())
|
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.
|
// hostConfig using struct json tags.
|
||||||
func migrateConfigV2ToV3() {
|
func migrateConfigV2ToV3() {
|
||||||
if !isMcConfigExists() {
|
if !isMcConfigExists() {
|
||||||
@@ -171,15 +171,15 @@ func migrateConfigV2ToV3() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mcNewCfgV3, e := quick.New(cfgV3)
|
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())
|
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.
|
// field in host config. Also Use JavaScript notation for field names.
|
||||||
func migrateConfigV3ToV4() {
|
func migrateConfigV3ToV4() {
|
||||||
if !isMcConfigExists() {
|
if !isMcConfigExists() {
|
||||||
@@ -210,16 +210,16 @@ func migrateConfigV3ToV4() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mcNewCfgV4, e := quick.New(cfgV4)
|
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())
|
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() {
|
func migrateConfigV4ToV5() {
|
||||||
if !isMcConfigExists() {
|
if !isMcConfigExists() {
|
||||||
return
|
return
|
||||||
@@ -245,15 +245,15 @@ func migrateConfigV4ToV5() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mcNewCfgV5, e := quick.New(cfgV5)
|
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())
|
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.
|
// to host config. Also remove "." from s3 aws glob rule.
|
||||||
func migrateConfigV5ToV6() {
|
func migrateConfigV5ToV6() {
|
||||||
if !isMcConfigExists() {
|
if !isMcConfigExists() {
|
||||||
@@ -311,15 +311,15 @@ func migrateConfigV5ToV6() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mcNewCfgV6, e := quick.New(cfgV6)
|
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())
|
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.
|
// named Host config. Also no more glob match for host config entries.
|
||||||
func migrateConfigV6ToV7() {
|
func migrateConfigV6ToV7() {
|
||||||
if !isMcConfigExists() {
|
if !isMcConfigExists() {
|
||||||
@@ -390,15 +390,15 @@ func migrateConfigV6ToV7() {
|
|||||||
// Load default settings.
|
// Load default settings.
|
||||||
cfgV7.loadDefaults()
|
cfgV7.loadDefaults()
|
||||||
mcNewCfgV7, e := quick.New(cfgV7)
|
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())
|
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'.
|
// 'play.minio.io:9002' and 'dl.minio.io:9000'.
|
||||||
func migrateConfigV7ToV8() {
|
func migrateConfigV7ToV8() {
|
||||||
if !isMcConfigExists() {
|
if !isMcConfigExists() {
|
||||||
@@ -429,10 +429,10 @@ func migrateConfigV7ToV8() {
|
|||||||
// Load default settings.
|
// Load default settings.
|
||||||
cfgV8.loadDefaults()
|
cfgV8.loadDefaults()
|
||||||
mcNewCfgV8, e := quick.New(cfgV8)
|
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())
|
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())
|
||||||
}
|
}
|
||||||
|
@@ -94,7 +94,7 @@ type copyMessage struct {
|
|||||||
|
|
||||||
// String colorized copy message
|
// String colorized copy message
|
||||||
func (c copyMessage) String() string {
|
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
|
// JSON jsonified copy message
|
||||||
@@ -209,7 +209,7 @@ func doPrepareCopyURLs(session *sessionV8, trapCh <-chan bool) {
|
|||||||
console.Eraseline()
|
console.Eraseline()
|
||||||
}
|
}
|
||||||
if strings.Contains(cpURLs.Error.ToGoError().Error(), " is a folder.") {
|
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 {
|
} else {
|
||||||
errorIf(cpURLs.Error.Trace(), "Unable to prepare URL for copying.")
|
errorIf(cpURLs.Error.Trace(), "Unable to prepare URL for copying.")
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ func doCopySession(session *sessionV8) {
|
|||||||
console.Eraseline()
|
console.Eraseline()
|
||||||
}
|
}
|
||||||
errorIf(cpURLs.Error.Trace(cpURLs.SourceContent.URL.String()),
|
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) {
|
if isErrIgnored(cpURLs.Error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ func checkCopySyntax(ctx *cli.Context) {
|
|||||||
url := newClientURL(tgtURL)
|
url := newClientURL(tgtURL)
|
||||||
if url.Host != "" {
|
if url.Host != "" {
|
||||||
if url.Path == string(url.Separator) {
|
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]
|
srcURL := srcURLs[0]
|
||||||
_, srcContent, err := url2Stat(srcURL)
|
_, 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() {
|
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]
|
srcURL := srcURLs[0]
|
||||||
_, srcContent, err := url2Stat(srcURL)
|
_, 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() {
|
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.
|
// Check target.
|
||||||
if _, tgtContent, err := url2Stat(tgtURL); err == nil {
|
if _, tgtContent, err := url2Stat(tgtURL); err == nil {
|
||||||
if !tgtContent.Type.IsDir() {
|
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.
|
// incomplete uploads are not necessary for copy operation, no need to verify for them.
|
||||||
isIncomplete := false
|
isIncomplete := false
|
||||||
if err != nil && !isURLPrefixExists(srcURL, isIncomplete) {
|
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 {
|
if srcContent.Type.IsDir() && !isRecursive {
|
||||||
@@ -132,7 +132,7 @@ func checkCopySyntaxTypeC(srcURLs []string, tgtURL string, isRecursive bool) {
|
|||||||
// Check target.
|
// Check target.
|
||||||
if _, tgtContent, err := url2Stat(tgtURL); err == nil {
|
if _, tgtContent, err := url2Stat(tgtURL); err == nil {
|
||||||
if !tgtContent.Type.IsDir() {
|
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
|
// Check target if it is a dir
|
||||||
if _, tgtContent, err := url2Stat(tgtURL); err == nil {
|
if _, tgtContent, err := url2Stat(tgtURL); err == nil {
|
||||||
if !tgtContent.Type.IsDir() {
|
if !tgtContent.Type.IsDir() {
|
||||||
fatalIf(errInvalidArgument().Trace(tgtURL), "Target ‘"+tgtURL+"’ is not a folder.")
|
fatalIf(errInvalidArgument().Trace(tgtURL), "Target `"+tgtURL+"` is not a folder.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -79,19 +79,19 @@ func (d diffMessage) String() string {
|
|||||||
switch d.Diff {
|
switch d.Diff {
|
||||||
case differInFirst:
|
case differInFirst:
|
||||||
msg = console.Colorize("DiffMessage",
|
msg = console.Colorize("DiffMessage",
|
||||||
"‘"+d.FirstURL+"’") + console.Colorize("DiffOnlyInFirst", " - only in first.")
|
"`"+d.FirstURL+"`") + console.Colorize("DiffOnlyInFirst", " - only in first.")
|
||||||
case differInSecond:
|
case differInSecond:
|
||||||
msg = console.Colorize("DiffMessage",
|
msg = console.Colorize("DiffMessage",
|
||||||
"‘"+d.SecondURL+"’") + console.Colorize("DiffOnlyInSecond", " - only in second.")
|
"`"+d.SecondURL+"`") + console.Colorize("DiffOnlyInSecond", " - only in second.")
|
||||||
case differInType:
|
case differInType:
|
||||||
msg = console.Colorize("DiffMessage",
|
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:
|
case differInSize:
|
||||||
msg = console.Colorize("DiffMessage",
|
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:
|
default:
|
||||||
fatalIf(errDummy().Trace(d.FirstURL, d.SecondURL),
|
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
|
return msg
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ func (d diffMessage) JSON() string {
|
|||||||
d.Status = "success"
|
d.Status = "success"
|
||||||
diffJSONBytes, e := json.Marshal(d)
|
diffJSONBytes, e := json.Marshal(d)
|
||||||
fatalIf(probe.NewError(e),
|
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)
|
return string(diffJSONBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ func checkDiffSyntax(ctx *cli.Context) {
|
|||||||
|
|
||||||
// Verify if its a directory.
|
// Verify if its a directory.
|
||||||
if !firstContent.Type.IsDir() {
|
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.
|
// Verify if secondURL is accessible.
|
||||||
@@ -140,7 +140,7 @@ func checkDiffSyntax(ctx *cli.Context) {
|
|||||||
|
|
||||||
// Verify if its a directory.
|
// Verify if its a directory.
|
||||||
if !secondContent.Type.IsDir() {
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -99,7 +99,7 @@ func checkListSyntax(ctx *cli.Context) {
|
|||||||
if _, ok := err.ToGoError().(BucketNameEmpty); ok {
|
if _, ok := err.ToGoError().(BucketNameEmpty); ok {
|
||||||
continue
|
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 {
|
for _, targetURL := range args {
|
||||||
var clnt Client
|
var clnt Client
|
||||||
clnt, err := newClient(targetURL)
|
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
|
var st *clientContent
|
||||||
if st, err = clnt.Stat(isIncomplete); err != nil {
|
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.
|
// For aliases like ``mc ls s3`` it's acceptable to receive BucketNameEmpty error.
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
default:
|
default:
|
||||||
fatalIf(err.Trace(targetURL), "Unable to initialize target ‘"+targetURL+"’.")
|
fatalIf(err.Trace(targetURL), "Unable to initialize target `"+targetURL+"`.")
|
||||||
}
|
}
|
||||||
} else if st.Type.IsDir() {
|
} else if st.Type.IsDir() {
|
||||||
if !strings.HasSuffix(targetURL, string(clnt.GetURL().Separator)) {
|
if !strings.HasSuffix(targetURL, string(clnt.GetURL().Separator)) {
|
||||||
targetURL = targetURL + string(clnt.GetURL().Separator)
|
targetURL = targetURL + string(clnt.GetURL().Separator)
|
||||||
}
|
}
|
||||||
clnt, err = newClient(targetURL)
|
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 {
|
if e := doList(clnt, isRecursive, isIncomplete); e != nil {
|
||||||
cErr = e
|
cErr = e
|
||||||
|
@@ -92,16 +92,16 @@ func Main() {
|
|||||||
|
|
||||||
// Function invoked when invalid command is passed.
|
// Function invoked when invalid command is passed.
|
||||||
func commandNotFound(ctx *cli.Context, command string) {
|
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)
|
closestCommands := findClosestCommands(command)
|
||||||
if len(closestCommands) > 0 {
|
if len(closestCommands) > 0 {
|
||||||
msg += fmt.Sprintf("\n\nDid you mean one of these?\n")
|
msg += fmt.Sprintf("\n\nDid you mean one of these?\n")
|
||||||
if len(closestCommands) == 1 {
|
if len(closestCommands) == 1 {
|
||||||
cmd := closestCommands[0]
|
cmd := closestCommands[0]
|
||||||
msg += fmt.Sprintf(" ‘%s’", cmd)
|
msg += fmt.Sprintf(" `%s`", cmd)
|
||||||
} else {
|
} else {
|
||||||
for _, cmd := range closestCommands {
|
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())
|
err := saveMcConfig(newMcConfig())
|
||||||
fatalIf(err.Trace(), "Unable to save new mc config.")
|
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.
|
// Check if mc session folder exists.
|
||||||
|
@@ -30,7 +30,7 @@ var (
|
|||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "region",
|
Name: "region",
|
||||||
Value: "us-east-1",
|
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.
|
2. Create a new bucket on Google Cloud Storage.
|
||||||
$ {{.HelpName}} gcs/miniocloud
|
$ {{.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
|
$ {{.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
|
$ {{.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
|
$ {{.HelpName}} /mnt/sdb/mydisk /mnt/sdc/mydisk /mnt/sdd/mydisk
|
||||||
|
|
||||||
`,
|
`,
|
||||||
@@ -79,7 +79,7 @@ type makeBucketMessage struct {
|
|||||||
|
|
||||||
// String colorized make bucket message.
|
// String colorized make bucket message.
|
||||||
func (s makeBucketMessage) String() string {
|
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.
|
// JSON jsonified make bucket message.
|
||||||
@@ -115,7 +115,7 @@ func mainMakeBucket(ctx *cli.Context) error {
|
|||||||
// Instantiate client for URL.
|
// Instantiate client for URL.
|
||||||
clnt, err := newClient(targetURL)
|
clnt, err := newClient(targetURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorIf(err.Trace(targetURL), "Invalid target ‘"+targetURL+"’.")
|
errorIf(err.Trace(targetURL), "Invalid target `"+targetURL+"`.")
|
||||||
cErr = exitStatus(globalErrorExitStatus)
|
cErr = exitStatus(globalErrorExitStatus)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ func mainMakeBucket(ctx *cli.Context) error {
|
|||||||
// Make bucket.
|
// Make bucket.
|
||||||
err = clnt.MakeBucket(region)
|
err = clnt.MakeBucket(region)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorIf(err.Trace(targetURL), "Unable to make bucket ‘"+targetURL+"’.")
|
errorIf(err.Trace(targetURL), "Unable to make bucket `"+targetURL+"`.")
|
||||||
cErr = exitStatus(globalErrorExitStatus)
|
cErr = exitStatus(globalErrorExitStatus)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@@ -154,7 +154,7 @@ type mirrorMessage struct {
|
|||||||
|
|
||||||
// String colorized mirror message
|
// String colorized mirror message
|
||||||
func (m mirrorMessage) String() string {
|
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
|
// JSON jsonified mirror message
|
||||||
@@ -254,11 +254,11 @@ func (mj *mirrorJob) startStatus() {
|
|||||||
// don't print over the ongoing progress bar.
|
// don't print over the ongoing progress bar.
|
||||||
if sURLs.SourceContent != nil {
|
if sURLs.SourceContent != nil {
|
||||||
errorIf(sURLs.Error.Trace(sURLs.SourceContent.URL.String()),
|
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 {
|
} else {
|
||||||
// When sURLs.SourceContent is nil, we know that we have an error related to removing
|
// When sURLs.SourceContent is nil, we know that we have an error related to removing
|
||||||
errorIf(sURLs.Error.Trace(sURLs.TargetContent.URL.String()),
|
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 sURLs.Error != nil {
|
||||||
if strings.Contains(sURLs.Error.ToGoError().Error(), " is a folder.") {
|
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 {
|
} else {
|
||||||
mj.status.errorIf(sURLs.Error.Trace(), "Unable to prepare URL for copying.")
|
mj.status.errorIf(sURLs.Error.Trace(), "Unable to prepare URL for copying.")
|
||||||
}
|
}
|
||||||
|
@@ -45,11 +45,11 @@ func checkMirrorSyntax(ctx *cli.Context) {
|
|||||||
// incomplete uploads are not necessary for copy operation, no need to verify for them.
|
// incomplete uploads are not necessary for copy operation, no need to verify for them.
|
||||||
isIncomplete := false
|
isIncomplete := false
|
||||||
if err != nil && !isURLPrefixExists(srcURL, isIncomplete) {
|
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() {
|
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.Host != "" {
|
||||||
if url.Path == string(url.Separator) {
|
if url.Path == string(url.Separator) {
|
||||||
fatalIf(errInvalidArgument().Trace(tgtURL),
|
fatalIf(errInvalidArgument().Trace(tgtURL),
|
||||||
fmt.Sprintf("Target ‘%s’ does not contain bucket name.", tgtURL))
|
fmt.Sprintf("Target `%s` does not contain bucket name.", tgtURL))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -111,11 +111,11 @@ type policyMessage struct {
|
|||||||
func (s policyMessage) String() string {
|
func (s policyMessage) String() string {
|
||||||
if s.Operation == "set" {
|
if s.Operation == "set" {
|
||||||
return console.Colorize("Policy",
|
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" {
|
if s.Operation == "get" {
|
||||||
return console.Colorize("Policy",
|
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
|
// nothing to print
|
||||||
return ""
|
return ""
|
||||||
@@ -183,7 +183,7 @@ func checkPolicySyntax(ctx *cli.Context) {
|
|||||||
default:
|
default:
|
||||||
if argsLength == 2 {
|
if argsLength == 2 {
|
||||||
fatalIf(errDummy().Trace(),
|
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 {
|
if err != nil {
|
||||||
switch err.ToGoError().(type) {
|
switch err.ToGoError().(type) {
|
||||||
case APINotImplemented:
|
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:
|
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 {
|
for k, v := range policies {
|
||||||
@@ -282,9 +282,9 @@ func runPolicyLinksCmd(ctx *cli.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.ToGoError().(type) {
|
switch err.ToGoError().(type) {
|
||||||
case APINotImplemented:
|
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:
|
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
|
// Construct the new path to search for public objects
|
||||||
newURL := alias + "/" + policyPath
|
newURL := alias + "/" + policyPath
|
||||||
clnt, err := newClient(newURL)
|
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
|
// Search for public objects
|
||||||
for content := range clnt.List(isRecursive, isIncomplete, DirFirst) {
|
for content := range clnt.List(isRecursive, isIncomplete, DirFirst) {
|
||||||
if content.Err != nil {
|
if content.Err != nil {
|
||||||
@@ -346,10 +346,10 @@ func runPolicyCmd(ctx *cli.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.ToGoError().(type) {
|
switch err.ToGoError().(type) {
|
||||||
case APINotImplemented:
|
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:
|
default:
|
||||||
fatalIf(err.Trace(targetURL, string(perms)),
|
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 {
|
if err != nil {
|
||||||
switch err.ToGoError().(type) {
|
switch err.ToGoError().(type) {
|
||||||
case APINotImplemented:
|
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:
|
default:
|
||||||
fatalIf(err.Trace(targetURL), "Unable to get policy for ‘"+targetURL+"’.")
|
fatalIf(err.Trace(targetURL), "Unable to get policy for `"+targetURL+"`.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -105,7 +105,7 @@ type rmMessage struct {
|
|||||||
|
|
||||||
// Colorized message for console printing.
|
// Colorized message for console printing.
|
||||||
func (r rmMessage) String() string {
|
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.
|
// JSON'ified message for scripting.
|
||||||
@@ -138,13 +138,13 @@ func removeSingle(url string, isIncomplete bool, isFake bool, older int) error {
|
|||||||
targetAlias, targetURL, _ := mustExpandAlias(url)
|
targetAlias, targetURL, _ := mustExpandAlias(url)
|
||||||
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
|
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
|
||||||
if pErr != nil {
|
if pErr != nil {
|
||||||
errorIf(pErr.Trace(url), "Invalid argument ‘"+url+"’.")
|
errorIf(pErr.Trace(url), "Invalid argument `"+url+"`.")
|
||||||
return exitStatus(globalErrorExitStatus) // End of journey.
|
return exitStatus(globalErrorExitStatus) // End of journey.
|
||||||
}
|
}
|
||||||
|
|
||||||
content, pErr := clnt.Stat(isIncomplete)
|
content, pErr := clnt.Stat(isIncomplete)
|
||||||
if pErr != nil {
|
if pErr != nil {
|
||||||
errorIf(pErr.Trace(url), "Failed to remove ‘"+url+"’.")
|
errorIf(pErr.Trace(url), "Failed to remove `"+url+"`.")
|
||||||
return exitStatus(globalErrorExitStatus)
|
return exitStatus(globalErrorExitStatus)
|
||||||
}
|
}
|
||||||
if older > 0 {
|
if older > 0 {
|
||||||
@@ -170,7 +170,7 @@ func removeSingle(url string, isIncomplete bool, isFake bool, older int) error {
|
|||||||
errorCh := clnt.Remove(isIncomplete, contentCh)
|
errorCh := clnt.Remove(isIncomplete, contentCh)
|
||||||
for pErr := range errorCh {
|
for pErr := range errorCh {
|
||||||
if pErr != nil {
|
if pErr != nil {
|
||||||
errorIf(pErr.Trace(url), "Failed to remove ‘"+url+"’.")
|
errorIf(pErr.Trace(url), "Failed to remove `"+url+"`.")
|
||||||
switch pErr.ToGoError().(type) {
|
switch pErr.ToGoError().(type) {
|
||||||
case PathInsufficientPermission:
|
case PathInsufficientPermission:
|
||||||
// Ignore Permission error.
|
// Ignore Permission error.
|
||||||
@@ -187,7 +187,7 @@ func removeRecursive(url string, isIncomplete bool, isFake bool, older int) erro
|
|||||||
targetAlias, targetURL, _ := mustExpandAlias(url)
|
targetAlias, targetURL, _ := mustExpandAlias(url)
|
||||||
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
|
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
|
||||||
if pErr != nil {
|
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.
|
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) {
|
for content := range clnt.List(isRecursive, isIncomplete, DirLast) {
|
||||||
isEmpty = false
|
isEmpty = false
|
||||||
if content.Err != nil {
|
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) {
|
switch content.Err.ToGoError().(type) {
|
||||||
case PathInsufficientPermission:
|
case PathInsufficientPermission:
|
||||||
// Ignore Permission error.
|
// Ignore Permission error.
|
||||||
@@ -232,7 +232,7 @@ func removeRecursive(url string, isIncomplete bool, isFake bool, older int) erro
|
|||||||
case contentCh <- content:
|
case contentCh <- content:
|
||||||
sent = true
|
sent = true
|
||||||
case pErr := <-errorCh:
|
case pErr := <-errorCh:
|
||||||
errorIf(pErr.Trace(urlString), "Failed to remove ‘"+urlString+"’.")
|
errorIf(pErr.Trace(urlString), "Failed to remove `"+urlString+"`.")
|
||||||
switch pErr.ToGoError().(type) {
|
switch pErr.ToGoError().(type) {
|
||||||
case PathInsufficientPermission:
|
case PathInsufficientPermission:
|
||||||
// Ignore Permission error.
|
// Ignore Permission error.
|
||||||
@@ -248,7 +248,7 @@ func removeRecursive(url string, isIncomplete bool, isFake bool, older int) erro
|
|||||||
|
|
||||||
close(contentCh)
|
close(contentCh)
|
||||||
for pErr := range errorCh {
|
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) {
|
switch pErr.ToGoError().(type) {
|
||||||
case PathInsufficientPermission:
|
case PathInsufficientPermission:
|
||||||
// Ignore Permission error.
|
// Ignore Permission error.
|
||||||
|
@@ -108,7 +108,7 @@ type clearSessionMessage struct {
|
|||||||
|
|
||||||
// String colorized clear session message.
|
// String colorized clear session message.
|
||||||
func (c clearSessionMessage) String() string {
|
func (c clearSessionMessage) String() string {
|
||||||
msg := "Session ‘" + c.SessionID + "’"
|
msg := "Session `" + c.SessionID + "`"
|
||||||
var colorizedMsg string
|
var colorizedMsg string
|
||||||
switch c.Status {
|
switch c.Status {
|
||||||
case "success":
|
case "success":
|
||||||
@@ -132,9 +132,9 @@ func clearSession(sid string) {
|
|||||||
if sid == "all" {
|
if sid == "all" {
|
||||||
for _, sid := range getSessionIDs() {
|
for _, sid := range getSessionIDs() {
|
||||||
session, err := loadSessionV8(sid)
|
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})
|
printMsg(clearSessionMessage{Status: "success", SessionID: sid})
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ func clearSession(sid string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !isSessionExists(sid) {
|
if !isSessionExists(sid) {
|
||||||
fatalIf(errDummy().Trace(sid), "Session ‘"+sid+"’ not found.")
|
fatalIf(errDummy().Trace(sid), "Session `"+sid+"` not found.")
|
||||||
}
|
}
|
||||||
|
|
||||||
session, err := loadSessionV8(sid)
|
session, err := loadSessionV8(sid)
|
||||||
@@ -156,7 +156,7 @@ func clearSession(sid string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if session != nil {
|
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})
|
printMsg(clearSessionMessage{Status: "success", SessionID: sid})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,11 +228,11 @@ func mainSession(ctx *cli.Context) error {
|
|||||||
sid := strings.TrimSpace(ctx.Args().Tail().First())
|
sid := strings.TrimSpace(ctx.Args().Tail().First())
|
||||||
if !isSessionExists(sid) {
|
if !isSessionExists(sid) {
|
||||||
closestSessions := findClosestSessions(sid)
|
closestSessions := findClosestSessions(sid)
|
||||||
errorMsg := "Session ‘" + sid + "’ not found."
|
errorMsg := "Session `" + sid + "` not found."
|
||||||
if len(closestSessions) > 0 {
|
if len(closestSessions) > 0 {
|
||||||
errorMsg += fmt.Sprintf("\n\nDid you mean?\n")
|
errorMsg += fmt.Sprintf("\n\nDid you mean?\n")
|
||||||
for _, session := range closestSessions {
|
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 on the first one, it is good enough.
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -262,7 +262,7 @@ func mainSession(ctx *cli.Context) error {
|
|||||||
|
|
||||||
// change folder back to saved path.
|
// change folder back to saved path.
|
||||||
e = os.Chdir(savedCwd)
|
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.
|
// purge a requested pending session, if "all" purge everything.
|
||||||
case "clear":
|
case "clear":
|
||||||
clearSession(strings.TrimSpace(ctx.Args().Tail().First()))
|
clearSession(strings.TrimSpace(ctx.Args().Tail().First()))
|
||||||
|
@@ -34,11 +34,11 @@ func migrateSessionV7ToV8() {
|
|||||||
if os.IsNotExist(err.ToGoError()) {
|
if os.IsNotExist(err.ToGoError()) {
|
||||||
continue
|
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)
|
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.
|
if sessionVersion > 7 { // It is new format.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ func migrateSessionV7ToV8() {
|
|||||||
e = qs.Save(sessionFile)
|
e = qs.Save(sessionFile)
|
||||||
fatalIf(probe.NewError(e).Trace(sid, sessionFile), "Unable to migrate session from '7' to '8'.")
|
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()) {
|
if os.IsNotExist(err.ToGoError()) {
|
||||||
continue
|
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)
|
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.
|
if sessionVersion > 6 { // It is new format.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ func migrateSessionV6ToV7() {
|
|||||||
e = qs.Save(sessionFile)
|
e = qs.Save(sessionFile)
|
||||||
fatalIf(probe.NewError(e).Trace(sid, sessionFile), "Unable to migrate session from '6' to '7'.")
|
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()) {
|
if os.IsNotExist(err.ToGoError()) {
|
||||||
continue
|
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)
|
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.
|
if sessionVersion > 5 { // It is new format.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -153,12 +153,12 @@ func migrateSessionV5ToV6() {
|
|||||||
sessionDataFile, err := getSessionDataFile(sid)
|
sessionDataFile, err := getSessionDataFile(sid)
|
||||||
fatalIf(err.Trace(sid), "Unable to get session data file.")
|
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 {
|
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 {
|
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+"`.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -371,7 +371,7 @@ func (s *sessionV8) Delete() *probe.Error {
|
|||||||
// Close a session and exit.
|
// Close a session and exit.
|
||||||
func (s sessionV8) CloseAndDie() {
|
func (s sessionV8) CloseAndDie() {
|
||||||
s.Close()
|
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
|
// Create a factory function to simplify checking if
|
||||||
|
@@ -85,7 +85,7 @@ func getSessionFile(sid string) (string, *probe.Error) {
|
|||||||
// isSessionExists verifies if given session exists.
|
// isSessionExists verifies if given session exists.
|
||||||
func isSessionExists(sid string) bool {
|
func isSessionExists(sid string) bool {
|
||||||
sessionFile, err := getSessionFile(sid)
|
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 {
|
if _, e := os.Stat(sessionFile); e != nil {
|
||||||
return false
|
return false
|
||||||
@@ -111,7 +111,7 @@ func getSessionIDs() (sids []string) {
|
|||||||
fatalIf(err.Trace(), "Unable to access session folder.")
|
fatalIf(err.Trace(), "Unable to access session folder.")
|
||||||
|
|
||||||
sessionList, e := filepath.Glob(sessionDir + "/*.json")
|
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 {
|
for _, path := range sessionList {
|
||||||
sids = append(sids, strings.TrimSuffix(filepath.Base(path), ".json"))
|
sids = append(sids, strings.TrimSuffix(filepath.Base(path), ".json"))
|
||||||
|
@@ -78,7 +78,7 @@ func checkShareDownloadSyntax(ctx *cli.Context) {
|
|||||||
if expireArg != "" {
|
if expireArg != "" {
|
||||||
var e error
|
var e error
|
||||||
expiry, e = time.ParseDuration(expireArg)
|
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.
|
// Validate expiry.
|
||||||
@@ -91,7 +91,7 @@ func checkShareDownloadSyntax(ctx *cli.Context) {
|
|||||||
|
|
||||||
for _, url := range ctx.Args() {
|
for _, url := range ctx.Args() {
|
||||||
_, _, err := url2Stat(url)
|
_, _, 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") != "" {
|
if ctx.String("expire") != "" {
|
||||||
var e error
|
var e error
|
||||||
expiry, e = time.ParseDuration(ctx.String("expire"))
|
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() {
|
for _, targetURL := range ctx.Args() {
|
||||||
@@ -178,9 +178,9 @@ func mainShareDownload(ctx *cli.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.ToGoError().(type) {
|
switch err.ToGoError().(type) {
|
||||||
case APINotImplemented:
|
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:
|
default:
|
||||||
fatalIf(err.Trace(targetURL), "Unable to share target ‘"+targetURL+"’.")
|
fatalIf(err.Trace(targetURL), "Unable to share target `"+targetURL+"`.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,7 @@ func checkShareListSyntax(ctx *cli.Context) {
|
|||||||
// doShareList list shared url's.
|
// doShareList list shared url's.
|
||||||
func doShareList(cmd string) *probe.Error {
|
func doShareList(cmd string) *probe.Error {
|
||||||
if cmd != "upload" && cmd != "download" {
|
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.
|
// Fetch defaults.
|
||||||
|
@@ -67,8 +67,8 @@ func migrateShare() {
|
|||||||
if _, e := os.Stat(oldShareFile); e == nil {
|
if _, e := os.Stat(oldShareFile); e == nil {
|
||||||
// Old file exits.
|
// Old file exits.
|
||||||
e := os.Remove(oldShareFile)
|
e := os.Remove(oldShareFile)
|
||||||
fatalIf(probe.NewError(e), "Unable to delete old ‘"+oldShareFile+"’.")
|
fatalIf(probe.NewError(e), "Unable to delete old `"+oldShareFile+"`.")
|
||||||
console.Infof("Removed older version of share ‘%s’ file.\n", oldShareFile)
|
console.Infof("Removed older version of share `%s` file.\n", oldShareFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ var (
|
|||||||
// Share documents via URL.
|
// Share documents via URL.
|
||||||
var shareUpload = cli.Command{
|
var shareUpload = cli.Command{
|
||||||
Name: "upload",
|
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,
|
Action: mainShareUpload,
|
||||||
Before: setGlobalsFromContext,
|
Before: setGlobalsFromContext,
|
||||||
Flags: append(shareUploadFlags, globalFlags...),
|
Flags: append(shareUploadFlags, globalFlags...),
|
||||||
@@ -84,7 +84,7 @@ func checkShareUploadSyntax(ctx *cli.Context) {
|
|||||||
if expireArg != "" {
|
if expireArg != "" {
|
||||||
var e error
|
var e error
|
||||||
expiry, e = time.ParseDuration(expireArg)
|
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.
|
// Validate expiry.
|
||||||
@@ -195,7 +195,7 @@ func mainShareUpload(ctx *cli.Context) error {
|
|||||||
if expireArg != "" {
|
if expireArg != "" {
|
||||||
var e error
|
var e error
|
||||||
expiry, e = time.ParseDuration(expireArg)
|
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() {
|
for _, targetURL := range ctx.Args() {
|
||||||
@@ -203,9 +203,9 @@ func mainShareUpload(ctx *cli.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.ToGoError().(type) {
|
switch err.ToGoError().(type) {
|
||||||
case APINotImplemented:
|
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:
|
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+"`.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
14
cmd/share.go
14
cmd/share.go
@@ -113,7 +113,7 @@ func getShareDir() (string, *probe.Error) {
|
|||||||
return sharedURLsDataDir, nil
|
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 {
|
func mustGetShareDir() string {
|
||||||
shareDir, err := getShareDir()
|
shareDir, err := getShareDir()
|
||||||
fatalIf(err.Trace(), "Unable to determine share folder.")
|
fatalIf(err.Trace(), "Unable to determine share folder.")
|
||||||
@@ -177,21 +177,21 @@ func initShareConfig() {
|
|||||||
// Share directory.
|
// Share directory.
|
||||||
if !isShareDirExists() {
|
if !isShareDirExists() {
|
||||||
fatalIf(createShareDir().Trace(mustGetShareDir()),
|
fatalIf(createShareDir().Trace(mustGetShareDir()),
|
||||||
"Failed to create share ‘"+mustGetShareDir()+"’ folder.")
|
"Failed to create share `"+mustGetShareDir()+"` folder.")
|
||||||
console.Infof("Successfully created ‘%s’.\n", mustGetShareDir())
|
console.Infof("Successfully created `%s`.\n", mustGetShareDir())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uploads share file.
|
// Uploads share file.
|
||||||
if !isShareUploadsExists() {
|
if !isShareUploadsExists() {
|
||||||
fatalIf(initShareUploadsFile().Trace(getShareUploadsFile()),
|
fatalIf(initShareUploadsFile().Trace(getShareUploadsFile()),
|
||||||
"Failed to initialize share uploads ‘"+getShareUploadsFile()+"’ file.")
|
"Failed to initialize share uploads `"+getShareUploadsFile()+"` file.")
|
||||||
console.Infof("Initialized share uploads ‘%s’ file.\n", getShareUploadsFile())
|
console.Infof("Initialized share uploads `%s` file.\n", getShareUploadsFile())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Downloads share file.
|
// Downloads share file.
|
||||||
if !isShareDownloadsExists() {
|
if !isShareDownloadsExists() {
|
||||||
fatalIf(initShareDownloadsFile().Trace(getShareDownloadsFile()),
|
fatalIf(initShareDownloadsFile().Trace(getShareDownloadsFile()),
|
||||||
"Failed to initialize share downloads ‘"+getShareDownloadsFile()+"’ file.")
|
"Failed to initialize share downloads `"+getShareDownloadsFile()+"` file.")
|
||||||
console.Infof("Initialized share downloads ‘%s’ file.\n", getShareDownloadsFile())
|
console.Infof("Initialized share downloads `%s` file.\n", getShareDownloadsFile())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,30 +36,30 @@ var (
|
|||||||
}
|
}
|
||||||
|
|
||||||
errInvalidAliasedURL = func(URL string) *probe.Error {
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
errSourceTargetSame = func(URL string) *probe.Error {
|
||||||
|
@@ -77,7 +77,7 @@ type updateMessage struct {
|
|||||||
// String colorized update message.
|
// String colorized update message.
|
||||||
func (u updateMessage) String() string {
|
func (u updateMessage) String() string {
|
||||||
if u.olderThan == time.Duration(0) {
|
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)
|
return colorizeUpdateMessage(u.Download, u.olderThan)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user