mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
cli: Make sure to add --help flag for subcommands. (#3773)
--help is now back and prints properly with command help template.
This commit is contained in:
@@ -104,6 +104,10 @@ func registerApp() *cli.App {
|
||||
registerCommand(updateCmd)
|
||||
|
||||
// Set up app.
|
||||
cli.HelpFlag = cli.BoolFlag{
|
||||
Name: "help, h",
|
||||
Usage: "Show help.",
|
||||
}
|
||||
app := cli.NewApp()
|
||||
app.Name = "Minio"
|
||||
app.Author = "Minio.io"
|
||||
@@ -111,6 +115,8 @@ func registerApp() *cli.App {
|
||||
app.Usage = "Cloud Storage Server."
|
||||
app.Description = `Minio is an Amazon S3 compatible object storage server. Use it to store photos, videos, VMs, containers, log files, or any blob of data as objects.`
|
||||
app.Flags = globalFlags
|
||||
app.HideVersion = true // Hide `--version` flag, we already have `minio version`.
|
||||
app.HideHelpCommand = true // Hide `help, h` command, we already have `minio --help`.
|
||||
app.Commands = commands
|
||||
app.CustomAppHelpTemplate = minioHelpTemplate
|
||||
app.CommandNotFound = func(ctx *cli.Context, command string) {
|
||||
|
||||
@@ -79,7 +79,6 @@ EXAMPLES:
|
||||
$ export MINIO_SECRET_KEY=miniostorage
|
||||
$ {{.HelpName}} http://192.168.1.11/mnt/export/ http://192.168.1.12/mnt/export/ \
|
||||
http://192.168.1.13/mnt/export/ http://192.168.1.14/mnt/export/
|
||||
|
||||
`,
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ var updateCmd = cli.Command{
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} {{if .VisibleFlags}}[FLAGS]{{end}}
|
||||
{{.HelpName}}{{if .VisibleFlags}} [FLAGS]{{end}}
|
||||
{{if .VisibleFlags}}
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
@@ -56,8 +56,10 @@ EXIT STATUS:
|
||||
1 - New update is available.
|
||||
-1 - Error in getting update information.
|
||||
|
||||
VERSION:
|
||||
` + Version + `{{"\n"}}`,
|
||||
EXAMPLES:
|
||||
1. Check if there is a new update available:
|
||||
$ {{.HelpName}}
|
||||
`,
|
||||
}
|
||||
|
||||
const releaseTagTimeLayout = "2006-01-02T15-04-05Z"
|
||||
|
||||
@@ -29,10 +29,15 @@ var versionCmd = cli.Command{
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}}
|
||||
|
||||
VERSION:
|
||||
` + Version + `{{"\n"}}`,
|
||||
{{.HelpName}}{{if .VisibleFlags}} [FLAGS]{{end}}
|
||||
{{if .VisibleFlags}}
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}{{end}}
|
||||
EXAMPLES:
|
||||
1. Prints server version:
|
||||
$ {{.HelpName}}
|
||||
`,
|
||||
}
|
||||
|
||||
func mainVersion(ctx *cli.Context) {
|
||||
|
||||
Reference in New Issue
Block a user