NewShell returns a new [Shell] with default options.
()
| 109 | |
| 110 | // NewShell returns a new [Shell] with default options. |
| 111 | func NewShell() *Shell { |
| 112 | sh := &Shell{ |
| 113 | Config: exec.Config{ |
| 114 | Dir: errors.Log1(os.Getwd()), |
| 115 | Env: map[string]string{}, |
| 116 | Buffer: false, |
| 117 | }, |
| 118 | } |
| 119 | sh.Config.StdIO.SetFromOS() |
| 120 | sh.SSH = sshclient.NewConfig(&sh.Config) |
| 121 | sh.SSHClients = make(map[string]*sshclient.Client) |
| 122 | sh.Commands = make(map[string]func(args ...string)) |
| 123 | sh.InstallBuiltins() |
| 124 | return sh |
| 125 | } |
| 126 | |
| 127 | // StartContext starts a processing context, |
| 128 | // setting the Ctx and Cancel Fields. |