fix: use new CallExecCommand when checking to see how help is being called

This is part of ongoing work to remove usage of the depreated NewShellCmd.
This commit is contained in:
Jose Diaz-Gonzalez
2024-02-12 00:55:16 -05:00
parent 541eb1a1bc
commit 50239b056c
16 changed files with 114 additions and 82 deletions

View File

@@ -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")