MCPcopy Index your code
hub / github.com/docker/docker-agent / RunBangCommand

Method RunBangCommand

pkg/app/app.go:726–740  ·  view source on GitHub ↗
(ctx context.Context, command string)

Source from the content-addressed store, hash-verified

724}
725
726func (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

Callers 1

processMessageMethod · 0.80

Calls 3

ShellOutputFunction · 0.92
DetectShellFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected