diff --git a/cmd-options.go b/cmd-options.go index 461bbcd6..7f9cbb81 100644 --- a/cmd-options.go +++ b/cmd-options.go @@ -245,22 +245,36 @@ EXAMPLES: USAGE: mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} generate - mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} alias NAME:HOSTURL + mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} alias NAME HOSTURL EXAMPLES: 1. Generate mc config $ mc config generate 2. Add alias URLs - $ mc config alias zek:https://s3.amazonaws.com/ + $ mc config alias zek https://s3.amazonaws.com/ `, } updateCmd = cli.Command{ - Name: "update", - Usage: "Check for new software updates", - Description: "", - Action: runUpdateCmd, + Name: "update", + Usage: "Check for new software updates", + Action: runUpdateCmd, + CustomHelpTemplate: `Name: + mc {{.Name}} - {{.Usage}} + +USAGE: + mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} check + mc {{.Name}}{{if .Flags}} [ARGS...]{{end}} yes + +EXAMPLES: + 1. Check for new updates + $ mc update check + + 2. Download new minio client locally and update + $ mc update yes + +`, } ) diff --git a/main.go b/main.go index 4d4ae527..b7903525 100644 --- a/main.go +++ b/main.go @@ -102,9 +102,7 @@ func main() { } else { log.Debug = log.New(ioutil.Discard, "", 0) } - themeName := ctx.GlobalString("theme") - if console.IsValidTheme(themeName) { err := console.SetTheme(themeName) if err != nil { @@ -117,7 +115,7 @@ func main() { return nil } app.After = func(ctx *cli.Context) error { - if !isMcConfigExist() && ctx.Command.Name != "config" { + if !isMcConfigExist() { console.Fatalln("\"mc\" is not configured. Please run \"mc config generate\".") } return nil diff --git a/pkg/client/s3/client.go b/pkg/client/s3/client.go index 58d8af72..3e6c1ba2 100644 --- a/pkg/client/s3/client.go +++ b/pkg/client/s3/client.go @@ -123,8 +123,11 @@ func (c *s3Client) bucketURL(bucket string) string { if net.ParseIP(host) != nil { return fmt.Sprintf("%s://%s/%s", c.Scheme, c.Host, bucket) } - // For DNS hostname or amazonaws.com use subdomain style - url = fmt.Sprintf("%s://%s.%s/", c.Scheme, bucket, c.Host) + if strings.Contains(c.Host, "amazonaws.com") { + // amazonaws.com use subdomain style + return fmt.Sprintf("%s://%s.%s/", c.Scheme, bucket, c.Host) + } + url = fmt.Sprintf("%s://%s/%s", c.Scheme, c.Host, bucket) } return url }