(ctx context.Context, command string)
| 724 | } |
| 725 | |
| 726 | func (a *App) RunBangCommand(ctx context.Context, command string) { |
| 727 | command = strings.TrimSpace(command) |
| 728 | if command == "" { |
| 729 | a.events <- runtime.ShellOutput("Error: empty command") |
| 730 | return |
| 731 | } |
| 732 | |
| 733 | shell, argsPrefix := shellpath.DetectShell() |
| 734 | out, err := exec.CommandContext(ctx, shell, append(argsPrefix, command)...).CombinedOutput() |
| 735 | output := "$ " + command + "\n" + string(out) |
| 736 | if err != nil && len(out) == 0 { |
| 737 | output = "$ " + command + "\nError: " + err.Error() |
| 738 | } |
| 739 | a.events <- runtime.ShellOutput(output) |
| 740 | } |
| 741 | |
| 742 | // InjectUserMessage feeds content into the app exactly as if the user had |
| 743 | // typed and submitted it in the TUI. It is the entry point external drivers |
no test coverage detected