(args []string)
| 988 | } |
| 989 | |
| 990 | func (f *runExecFlags) buildAppOpts(args []string) ([]app.Opt, error) { |
| 991 | firstMessage, err := readInitialMessage(args) |
| 992 | if err != nil { |
| 993 | return nil, err |
| 994 | } |
| 995 | |
| 996 | var opts []app.Opt |
| 997 | if firstMessage != nil { |
| 998 | opts = append(opts, app.WithFirstMessage(*firstMessage)) |
| 999 | } else if f.attachmentPath != "" { |
| 1000 | // When --attach is used without an explicit message, provide a default |
| 1001 | // so that SendFirstMessage processes the attachment. |
| 1002 | defaultMsg := "" |
| 1003 | opts = append(opts, app.WithFirstMessage(defaultMsg)) |
| 1004 | } |
| 1005 | if len(args) > 2 { |
| 1006 | opts = append(opts, app.WithQueuedMessages(args[2:])) |
| 1007 | } |
| 1008 | if f.attachmentPath != "" { |
| 1009 | opts = append(opts, app.WithFirstMessageAttachment(f.attachmentPath)) |
| 1010 | } |
| 1011 | if f.exitAfterResponse { |
| 1012 | opts = append(opts, app.WithExitAfterFirstResponse()) |
| 1013 | } |
| 1014 | if f.snapshotController != nil { |
| 1015 | opts = append(opts, app.WithSnapshotController(f.snapshotController)) |
| 1016 | } |
| 1017 | if f.sessionReadOnly { |
| 1018 | opts = append(opts, app.WithReadOnly()) |
| 1019 | } |
| 1020 | return opts, nil |
| 1021 | } |
| 1022 | |
| 1023 | // buildSessionOpts returns the canonical set of session options derived from |
| 1024 | // CLI flags and agent configuration. Both the initial session and spawned |
no test coverage detected