newShell initializes the DevboxShell struct so it can be used to start a shell environment for the devbox project.
(envOpts devopt.EnvOptions, opts ...ShellOption)
| 73 | // newShell initializes the DevboxShell struct so it can be used to start a shell environment |
| 74 | // for the devbox project. |
| 75 | func (d *Devbox) newShell(envOpts devopt.EnvOptions, opts ...ShellOption) (*DevboxShell, error) { |
| 76 | shPath, err := d.shellPath(envOpts) |
| 77 | if err != nil { |
| 78 | return nil, err |
| 79 | } |
| 80 | sh := initShellBinaryFields(shPath) |
| 81 | sh.devbox = d |
| 82 | |
| 83 | for _, opt := range opts { |
| 84 | opt(sh) |
| 85 | } |
| 86 | |
| 87 | slog.Debug("detected user shell", "shell", sh.binPath, "initrc", sh.userShellrcPath) |
| 88 | return sh, nil |
| 89 | } |
| 90 | |
| 91 | // shellPath returns the path to a shell binary, or error if none found. |
| 92 | func (d *Devbox) shellPath(envOpts devopt.EnvOptions) (path string, err error) { |
no test coverage detected