shell.go 473 B

123456789101112131415
  1. package util
  2. import (
  3. "context"
  4. tea "charm.land/bubbletea/v2"
  5. "github.com/charmbracelet/crush/internal/uiutil"
  6. )
  7. // ExecShell parses a shell command string and executes it with exec.Command.
  8. // Uses shell.Fields for proper handling of shell syntax like quotes and
  9. // arguments while preserving TTY handling for terminal editors.
  10. func ExecShell(ctx context.Context, cmdStr string, callback tea.ExecCallback) tea.Cmd {
  11. return uiutil.ExecShell(ctx, cmdStr, callback)
  12. }