Merge pull request #3412 from dokku/full-golang-help
Ensure official golang plugins have correct help output
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/dokku/dokku/plugins/common"
|
||||||
"github.com/dokku/dokku/plugins/config"
|
"github.com/dokku/dokku/plugins/config"
|
||||||
columnize "github.com/ryanuber/columnize"
|
columnize "github.com/ryanuber/columnize"
|
||||||
)
|
)
|
||||||
@@ -43,10 +44,18 @@ func main() {
|
|||||||
merged := args.Bool("merged", false, "--merged: display the app's environment merged with the global environment")
|
merged := args.Bool("merged", false, "--merged: display the app's environment merged with the global environment")
|
||||||
args.Parse(os.Args[2:])
|
args.Parse(os.Args[2:])
|
||||||
config.CommandShow(args.Args(), *global, *shell, *export, *merged)
|
config.CommandShow(args.Args(), *global, *shell, *export, *merged)
|
||||||
case "help":
|
|
||||||
fmt.Print("\n config, Manages global and app-specific config vars\n")
|
|
||||||
case "config:help":
|
case "config:help":
|
||||||
usage()
|
usage()
|
||||||
|
case "help":
|
||||||
|
command := common.NewShellCmd(fmt.Sprintf("ps -o command= %d", os.Getppid()))
|
||||||
|
command.ShowOutput = false
|
||||||
|
output, err := command.Output()
|
||||||
|
|
||||||
|
if err == nil && strings.Contains(string(output), "--all") {
|
||||||
|
fmt.Println(helpContent)
|
||||||
|
} else {
|
||||||
|
fmt.Print("\n config, Manages global and app-specific config vars\n")
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
|
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -58,11 +67,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
|
fmt.Println(helpHeader)
|
||||||
config := columnize.DefaultConfig()
|
config := columnize.DefaultConfig()
|
||||||
config.Delim = ","
|
config.Delim = ","
|
||||||
config.Prefix = " "
|
config.Prefix = " "
|
||||||
config.Empty = ""
|
config.Empty = ""
|
||||||
content := strings.Split(helpContent, "\n")[1:]
|
content := strings.Split(helpContent, "\n")[1:]
|
||||||
fmt.Println(helpHeader)
|
|
||||||
fmt.Println(columnize.Format(content, config))
|
fmt.Println(columnize.Format(content, config))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/dokku/dokku/plugins/common"
|
||||||
columnize "github.com/ryanuber/columnize"
|
columnize "github.com/ryanuber/columnize"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -34,7 +35,15 @@ func main() {
|
|||||||
case "network", "network:help":
|
case "network", "network:help":
|
||||||
usage()
|
usage()
|
||||||
case "help":
|
case "help":
|
||||||
fmt.Print("\n network, Manages network settings for an app\n")
|
command := common.NewShellCmd(fmt.Sprintf("ps -o command= %d", os.Getppid()))
|
||||||
|
command.ShowOutput = false
|
||||||
|
output, err := command.Output()
|
||||||
|
|
||||||
|
if err == nil && strings.Contains(string(output), "--all") {
|
||||||
|
fmt.Println(helpContent)
|
||||||
|
} else {
|
||||||
|
fmt.Print("\n network, Manages network settings for an app\n")
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
|
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -46,11 +55,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
|
fmt.Println(helpHeader)
|
||||||
config := columnize.DefaultConfig()
|
config := columnize.DefaultConfig()
|
||||||
config.Delim = ","
|
config.Delim = ","
|
||||||
config.Prefix = " "
|
config.Prefix = " "
|
||||||
config.Empty = ""
|
config.Empty = ""
|
||||||
content := strings.Split(helpContent, "\n")[1:]
|
content := strings.Split(helpContent, "\n")[1:]
|
||||||
fmt.Println(helpHeader)
|
|
||||||
fmt.Println(columnize.Format(content, config))
|
fmt.Println(columnize.Format(content, config))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/dokku/dokku/plugins/common"
|
||||||
columnize "github.com/ryanuber/columnize"
|
columnize "github.com/ryanuber/columnize"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -32,7 +33,15 @@ func main() {
|
|||||||
case "repo", "repo:help":
|
case "repo", "repo:help":
|
||||||
usage()
|
usage()
|
||||||
case "help":
|
case "help":
|
||||||
fmt.Print("\n repo, Runs commands that interact with the app's repo\n")
|
command := common.NewShellCmd(fmt.Sprintf("ps -o command= %d", os.Getppid()))
|
||||||
|
command.ShowOutput = false
|
||||||
|
output, err := command.Output()
|
||||||
|
|
||||||
|
if err == nil && strings.Contains(string(output), "--all") {
|
||||||
|
fmt.Println(helpContent)
|
||||||
|
} else {
|
||||||
|
fmt.Print("\n repo, Runs commands that interact with the app's repo\n")
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
|
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -44,11 +53,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
|
fmt.Println(helpHeader)
|
||||||
config := columnize.DefaultConfig()
|
config := columnize.DefaultConfig()
|
||||||
config.Delim = ","
|
config.Delim = ","
|
||||||
config.Prefix = " "
|
config.Prefix = " "
|
||||||
config.Empty = ""
|
config.Empty = ""
|
||||||
content := strings.Split(helpContent, "\n")[1:]
|
content := strings.Split(helpContent, "\n")[1:]
|
||||||
fmt.Println(helpHeader)
|
|
||||||
fmt.Println(columnize.Format(content, config))
|
fmt.Println(columnize.Format(content, config))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user