Documentation
¶
Overview ¶
Package shell is the binary's door to every external command that is not git; gitx stays separate because its reads mirror bin/f10-load-project.sh. Every entry point is a variable so tests can substitute it: nothing here should launch a browser or block on a pager under `go test`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Capture = func(ctx context.Context, dir, name string, args ...string) (Result, error) { return run(ctx, dir, nil, name, args...) }
Capture runs name in dir. A non-zero exit is a Result, not an error, since the driver contract reserves an exit code with a meaning and classifying codes belongs to the caller; only a command that could not start is an error.
var CaptureInput = func(ctx context.Context, dir, input, name string, args ...string) (Result, error) { return run(ctx, dir, strings.NewReader(input), name, args...) }
CaptureInput is Capture with input on stdin, for a driver's write verbs.
Has reports whether name is on PATH.
var Passthrough = func(ctx context.Context, dir, name string, args ...string) error { cmd := exec.CommandContext(ctx, name, args...) cmd.Dir = dir cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr return cmd.Run() }
Passthrough runs name in dir wired straight to this process's streams. A pager, an editor and `gh --web` all want the terminal, not a buffer.
var Pipe = func(ctx context.Context, dir, input, name string, args ...string) error { cmd := exec.CommandContext(ctx, name, args...) cmd.Dir = dir cmd.Stdin = strings.NewReader(input) cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr return cmd.Run() }
Pipe runs name with input on its stdin and the terminal on its output: what a pager needs.