Documentation
¶
Index ¶
- func Fork(opts *Options, sessionID, newSessionID, dir string) error
- func Main(args []string, opts *Options) error
- func ResolveGrokBin(grokBin string, lookPath func(file string) (string, error)) (string, error)
- func ResumeForkArgv(sessionID, newSessionID string) []string
- func Run(args []string, opts *Options) error
- type Options
- type SessionLaunch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Main ¶
Main parses argv (no binary name) and runs Mode A (new window) or Mode B (current-terminal grok --resume --fork-session). It does not os.Exit and does not print an Error: prefix.
func ResolveGrokBin ¶
ResolveGrokBin returns grokBin if set, otherwise lookPath("grok").
func ResumeForkArgv ¶
ResumeForkArgv returns argv for `grok --resume <id> --fork-session` (no binary name). newSessionID, when set, appends `--session-id`.
Types ¶
type Options ¶
type Options struct {
Stdout, Stderr io.Writer
PID int
GrokHome string
ListProcs func() []procresolve.Proc
Lsof func(pid int) []string
OpenInNewTerminal func(dir, followUp string) error
RunForeground func(bin string, argv []string, dir string, env []string) error
GrokBin string
LookPath func(file string) (string, error)
Executable func() (string, error)
Env []string
}
Options configures Main. Hooks and homes are injectable; Main does not read GROK_HOME from the process environment.
type SessionLaunch ¶
type SessionLaunch struct {
SessionID string
NewSessionID string
Dir string
Bin string
Env []string
}
SessionLaunch is the shared in-process grok --resume --fork-session plan used by grok-fork Mode B and `agent-pro grok session fork`.
func (SessionLaunch) Argv ¶
func (s SessionLaunch) Argv() []string
Argv is ResumeForkArgv(SessionID, NewSessionID).
func (SessionLaunch) CommandLine ¶
func (s SessionLaunch) CommandLine() string
CommandLine is the unquoted display form `<bin> --resume <id> --fork-session`.
func (SessionLaunch) QuotedCommandLine ¶
func (s SessionLaunch) QuotedCommandLine() string
QuotedCommandLine quotes each token for an iTerm follow-up or dry-run.