diff --git a/plugins/app-json/src/commands/commands.go b/plugins/app-json/src/commands/commands.go index 548c51e40..fc8874a7a 100644 --- a/plugins/app-json/src/commands/commands.go +++ b/plugins/app-json/src/commands/commands.go @@ -32,11 +32,13 @@ func main() { case "app-json", "app-json:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n app-json, Manage app-json settings for an app\n") diff --git a/plugins/apps/src/commands/commands.go b/plugins/apps/src/commands/commands.go index b37257f76..2d121246a 100644 --- a/plugins/apps/src/commands/commands.go +++ b/plugins/apps/src/commands/commands.go @@ -49,11 +49,13 @@ func main() { case "apps:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n apps, Manage apps\n") diff --git a/plugins/builder/src/commands/commands.go b/plugins/builder/src/commands/commands.go index 55169ef42..a4b0549dc 100644 --- a/plugins/builder/src/commands/commands.go +++ b/plugins/builder/src/commands/commands.go @@ -32,11 +32,13 @@ func main() { case "builder", "builder:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n builder, Manage builder settings for an app\n") diff --git a/plugins/buildpacks/src/commands/commands.go b/plugins/buildpacks/src/commands/commands.go index 08ec2195c..d29b6e566 100644 --- a/plugins/buildpacks/src/commands/commands.go +++ b/plugins/buildpacks/src/commands/commands.go @@ -37,11 +37,13 @@ func main() { case "buildpacks", "buildpacks:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n buildpacks, Manage buildpack settings for an app\n") diff --git a/plugins/config/src/commands/commands.go b/plugins/config/src/commands/commands.go index 5c9d63c76..53bc00db8 100644 --- a/plugins/config/src/commands/commands.go +++ b/plugins/config/src/commands/commands.go @@ -53,11 +53,13 @@ func main() { case "config:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n config, Manage global and app-specific config vars\n") diff --git a/plugins/cron/src/commands/commands.go b/plugins/cron/src/commands/commands.go index 466d428bb..c648c35b4 100644 --- a/plugins/cron/src/commands/commands.go +++ b/plugins/cron/src/commands/commands.go @@ -33,11 +33,13 @@ func main() { case "cron", "cron:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n cron, Manage scheduled cron tasks\n") diff --git a/plugins/logs/src/commands/commands.go b/plugins/logs/src/commands/commands.go index bec7b2061..afa4f93f3 100644 --- a/plugins/logs/src/commands/commands.go +++ b/plugins/logs/src/commands/commands.go @@ -59,11 +59,13 @@ func main() { case "logs:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n logs, Manage log integration for an app\n") diff --git a/plugins/network/src/commands/commands.go b/plugins/network/src/commands/commands.go index e916485c5..66c285698 100644 --- a/plugins/network/src/commands/commands.go +++ b/plugins/network/src/commands/commands.go @@ -39,11 +39,13 @@ func main() { case "network", "network:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n network, Manage network settings for an app\n") diff --git a/plugins/ports/src/commands/commands.go b/plugins/ports/src/commands/commands.go index 9231d27bf..68c7460e4 100644 --- a/plugins/ports/src/commands/commands.go +++ b/plugins/ports/src/commands/commands.go @@ -36,11 +36,13 @@ func main() { case "ports", "ports:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n ports, Manage ports for an app\n") diff --git a/plugins/proxy/src/commands/commands.go b/plugins/proxy/src/commands/commands.go index 129cc2820..93ffc4f62 100644 --- a/plugins/proxy/src/commands/commands.go +++ b/plugins/proxy/src/commands/commands.go @@ -18,8 +18,8 @@ Manage the proxy integration for an app Additional commands:` helpContent = ` - proxy:build-config [--parallel count] [--all|], (Re)builds config for a given app - proxy:clear-config [--all|], Clears config for a given app + proxy:build-config [--parallel count] [--all|], (Re)builds config for a given app + proxy:clear-config [--all|], Clears config for a given app proxy:disable , Disable proxy for app proxy:enable , Enable proxy for app proxy:report [] [], Displays a proxy report for one or more apps @@ -36,11 +36,13 @@ func main() { case "proxy", "proxy:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n proxy, Manage the proxy integration for an app\n") diff --git a/plugins/ps/src/commands/commands.go b/plugins/ps/src/commands/commands.go index 00eb60d45..9f73c76d8 100644 --- a/plugins/ps/src/commands/commands.go +++ b/plugins/ps/src/commands/commands.go @@ -39,11 +39,13 @@ func main() { case "ps", "ps:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n ps, Manage app processes\n") diff --git a/plugins/registry/src/commands/commands.go b/plugins/registry/src/commands/commands.go index c6259c483..6b7ac8709 100644 --- a/plugins/registry/src/commands/commands.go +++ b/plugins/registry/src/commands/commands.go @@ -33,11 +33,13 @@ func main() { case "registry", "registry:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n registry, Manage registry settings for an app\n") diff --git a/plugins/repo/src/commands/commands.go b/plugins/repo/src/commands/commands.go index 92a5a80c9..2fb6b5ac6 100644 --- a/plugins/repo/src/commands/commands.go +++ b/plugins/repo/src/commands/commands.go @@ -32,11 +32,13 @@ func main() { case "repo", "repo:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n repo, Manage the app's repo\n") diff --git a/plugins/resource/src/commands/commands.go b/plugins/resource/src/commands/commands.go index 0c155a7b1..801cd1d04 100644 --- a/plugins/resource/src/commands/commands.go +++ b/plugins/resource/src/commands/commands.go @@ -35,11 +35,13 @@ func main() { case "resource", "resource:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n resource, Manage resource settings for an app\n") diff --git a/plugins/scheduler-k3s/src/commands/commands.go b/plugins/scheduler-k3s/src/commands/commands.go index d8071dfb7..e94890d76 100644 --- a/plugins/scheduler-k3s/src/commands/commands.go +++ b/plugins/scheduler-k3s/src/commands/commands.go @@ -42,11 +42,13 @@ func main() { case "scheduler-k3s", "scheduler-k3s:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n scheduler-k3s, Manage scheduler-k3s settings for an app\n") diff --git a/plugins/scheduler/src/commands/commands.go b/plugins/scheduler/src/commands/commands.go index 417eb77e7..4cde898ef 100644 --- a/plugins/scheduler/src/commands/commands.go +++ b/plugins/scheduler/src/commands/commands.go @@ -32,11 +32,13 @@ func main() { case "scheduler", "scheduler:help": 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") { + result, err := common.CallExecCommand(common.ExecCommandInput{ + Command: "ps", + Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())}, + CaptureOutput: true, + StreamStdio: false, + }) + if err == nil && strings.Contains(result.StdoutContents(), "--all") { fmt.Println(helpContent) } else { fmt.Print("\n scheduler, Manage scheduler settings for an app\n")