mirror of
https://github.com/pgsty/minio.git
synced 2026-09-18 08:18:27 +03:00
Update cli with new changes
This commit is contained in:
+18
-2
@@ -71,6 +71,7 @@ var helpCommand = Command{
|
||||
ShowAppHelp(c)
|
||||
}
|
||||
},
|
||||
Hide: true,
|
||||
}
|
||||
|
||||
var helpSubcommand = Command{
|
||||
@@ -85,6 +86,7 @@ var helpSubcommand = Command{
|
||||
ShowSubcommandHelp(c)
|
||||
}
|
||||
},
|
||||
Hide: true,
|
||||
}
|
||||
|
||||
// Prints help for the App
|
||||
@@ -99,19 +101,27 @@ func ShowAppHelp(c *Context) {
|
||||
// Make a copy of c.App context
|
||||
app := *c.App
|
||||
app.Flags = make([]Flag, 0)
|
||||
app.Commands = make([]Command, 0)
|
||||
for _, flag := range c.App.Flags {
|
||||
if flag.isNotHidden() {
|
||||
app.Flags = append(app.Flags, flag)
|
||||
}
|
||||
}
|
||||
for _, command := range c.App.Commands {
|
||||
if command.isNotHidden() {
|
||||
app.Commands = append(app.Commands, command)
|
||||
}
|
||||
}
|
||||
HelpPrinter(AppHelpTemplate, app)
|
||||
}
|
||||
|
||||
// Prints the list of subcommands as the default app completion method
|
||||
func DefaultAppComplete(c *Context) {
|
||||
for _, command := range c.App.Commands {
|
||||
for _, name := range command.Names() {
|
||||
fmt.Fprintln(c.App.Writer, name)
|
||||
if command.isNotHidden() {
|
||||
for _, name := range command.Names() {
|
||||
fmt.Fprintln(c.App.Writer, name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,11 +133,17 @@ func ShowCommandHelp(c *Context, command string) {
|
||||
// Make a copy of c.App context
|
||||
app := *c.App
|
||||
app.Flags = make([]Flag, 0)
|
||||
app.Commands = make([]Command, 0)
|
||||
for _, flag := range c.App.Flags {
|
||||
if flag.isNotHidden() {
|
||||
app.Flags = append(app.Flags, flag)
|
||||
}
|
||||
}
|
||||
for _, command := range c.App.Commands {
|
||||
if command.isNotHidden() {
|
||||
app.Commands = append(app.Commands, command)
|
||||
}
|
||||
}
|
||||
HelpPrinter(SubcommandHelpTemplate, app)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user