@@ -106,63 +106,63 @@ type DevcontainerCLI interface {
106
106
107
107
// DevcontainerCLIUpOptions are options for the devcontainer CLI Up
108
108
// command.
109
- type DevcontainerCLIUpOptions func (* devcontainerCLIUpConfig )
109
+ type DevcontainerCLIUpOptions func (* DevcontainerCLIUpConfig )
110
110
111
- type devcontainerCLIUpConfig struct {
112
- args []string // Additional arguments for the Up command.
113
- stdout io.Writer
114
- stderr io.Writer
111
+ type DevcontainerCLIUpConfig struct {
112
+ Args []string // Additional arguments for the Up command.
113
+ Stdout io.Writer
114
+ Stderr io.Writer
115
115
}
116
116
117
117
// WithRemoveExistingContainer is an option to remove the existing
118
118
// container.
119
119
func WithRemoveExistingContainer () DevcontainerCLIUpOptions {
120
- return func (o * devcontainerCLIUpConfig ) {
121
- o .args = append (o .args , "--remove-existing-container" )
120
+ return func (o * DevcontainerCLIUpConfig ) {
121
+ o .Args = append (o .Args , "--remove-existing-container" )
122
122
}
123
123
}
124
124
125
125
// WithUpOutput sets additional stdout and stderr writers for logs
126
126
// during Up operations.
127
127
func WithUpOutput (stdout , stderr io.Writer ) DevcontainerCLIUpOptions {
128
- return func (o * devcontainerCLIUpConfig ) {
129
- o .stdout = stdout
130
- o .stderr = stderr
128
+ return func (o * DevcontainerCLIUpConfig ) {
129
+ o .Stdout = stdout
130
+ o .Stderr = stderr
131
131
}
132
132
}
133
133
134
134
// DevcontainerCLIExecOptions are options for the devcontainer CLI Exec
135
135
// command.
136
- type DevcontainerCLIExecOptions func (* devcontainerCLIExecConfig )
136
+ type DevcontainerCLIExecOptions func (* DevcontainerCLIExecConfig )
137
137
138
- type devcontainerCLIExecConfig struct {
139
- args []string // Additional arguments for the Exec command.
140
- stdout io.Writer
141
- stderr io.Writer
138
+ type DevcontainerCLIExecConfig struct {
139
+ Args []string // Additional arguments for the Exec command.
140
+ Stdout io.Writer
141
+ Stderr io.Writer
142
142
}
143
143
144
144
// WithExecOutput sets additional stdout and stderr writers for logs
145
145
// during Exec operations.
146
146
func WithExecOutput (stdout , stderr io.Writer ) DevcontainerCLIExecOptions {
147
- return func (o * devcontainerCLIExecConfig ) {
148
- o .stdout = stdout
149
- o .stderr = stderr
147
+ return func (o * DevcontainerCLIExecConfig ) {
148
+ o .Stdout = stdout
149
+ o .Stderr = stderr
150
150
}
151
151
}
152
152
153
153
// WithExecContainerID sets the container ID to target a specific
154
154
// container.
155
155
func WithExecContainerID (id string ) DevcontainerCLIExecOptions {
156
- return func (o * devcontainerCLIExecConfig ) {
157
- o .args = append (o .args , "--container-id" , id )
156
+ return func (o * DevcontainerCLIExecConfig ) {
157
+ o .Args = append (o .Args , "--container-id" , id )
158
158
}
159
159
}
160
160
161
161
// WithRemoteEnv sets environment variables for the Exec command.
162
162
func WithRemoteEnv (env ... string ) DevcontainerCLIExecOptions {
163
- return func (o * devcontainerCLIExecConfig ) {
163
+ return func (o * DevcontainerCLIExecConfig ) {
164
164
for _ , e := range env {
165
- o .args = append (o .args , "--remote-env" , e )
165
+ o .Args = append (o .Args , "--remote-env" , e )
166
166
}
167
167
}
168
168
}
@@ -185,8 +185,8 @@ func WithReadConfigOutput(stdout, stderr io.Writer) DevcontainerCLIReadConfigOpt
185
185
}
186
186
}
187
187
188
- func applyDevcontainerCLIUpOptions (opts []DevcontainerCLIUpOptions ) devcontainerCLIUpConfig {
189
- conf := devcontainerCLIUpConfig { stdout : io .Discard , stderr : io .Discard }
188
+ func applyDevcontainerCLIUpOptions (opts []DevcontainerCLIUpOptions ) DevcontainerCLIUpConfig {
189
+ conf := DevcontainerCLIUpConfig { Stdout : io .Discard , Stderr : io .Discard }
190
190
for _ , opt := range opts {
191
191
if opt != nil {
192
192
opt (& conf )
@@ -195,8 +195,8 @@ func applyDevcontainerCLIUpOptions(opts []DevcontainerCLIUpOptions) devcontainer
195
195
return conf
196
196
}
197
197
198
- func applyDevcontainerCLIExecOptions (opts []DevcontainerCLIExecOptions ) devcontainerCLIExecConfig {
199
- conf := devcontainerCLIExecConfig { stdout : io .Discard , stderr : io .Discard }
198
+ func applyDevcontainerCLIExecOptions (opts []DevcontainerCLIExecOptions ) DevcontainerCLIExecConfig {
199
+ conf := DevcontainerCLIExecConfig { Stdout : io .Discard , Stderr : io .Discard }
200
200
for _ , opt := range opts {
201
201
if opt != nil {
202
202
opt (& conf )
@@ -241,7 +241,7 @@ func (d *devcontainerCLI) Up(ctx context.Context, workspaceFolder, configPath st
241
241
if configPath != "" {
242
242
args = append (args , "--config" , configPath )
243
243
}
244
- args = append (args , conf .args ... )
244
+ args = append (args , conf .Args ... )
245
245
cmd := d .execer .CommandContext (ctx , "devcontainer" , args ... )
246
246
247
247
// Capture stdout for parsing and stream logs for both default and provided writers.
@@ -251,14 +251,14 @@ func (d *devcontainerCLI) Up(ctx context.Context, workspaceFolder, configPath st
251
251
& devcontainerCLILogWriter {
252
252
ctx : ctx ,
253
253
logger : logger .With (slog .F ("stdout" , true )),
254
- writer : conf .stdout ,
254
+ writer : conf .Stdout ,
255
255
},
256
256
)
257
257
// Stream stderr logs and provided writer if any.
258
258
cmd .Stderr = & devcontainerCLILogWriter {
259
259
ctx : ctx ,
260
260
logger : logger .With (slog .F ("stderr" , true )),
261
- writer : conf .stderr ,
261
+ writer : conf .Stderr ,
262
262
}
263
263
264
264
if err := cmd .Run (); err != nil {
@@ -293,17 +293,17 @@ func (d *devcontainerCLI) Exec(ctx context.Context, workspaceFolder, configPath
293
293
if configPath != "" {
294
294
args = append (args , "--config" , configPath )
295
295
}
296
- args = append (args , conf .args ... )
296
+ args = append (args , conf .Args ... )
297
297
args = append (args , cmd )
298
298
args = append (args , cmdArgs ... )
299
299
c := d .execer .CommandContext (ctx , "devcontainer" , args ... )
300
300
301
- c .Stdout = io .MultiWriter (conf .stdout , & devcontainerCLILogWriter {
301
+ c .Stdout = io .MultiWriter (conf .Stdout , & devcontainerCLILogWriter {
302
302
ctx : ctx ,
303
303
logger : logger .With (slog .F ("stdout" , true )),
304
304
writer : io .Discard ,
305
305
})
306
- c .Stderr = io .MultiWriter (conf .stderr , & devcontainerCLILogWriter {
306
+ c .Stderr = io .MultiWriter (conf .Stderr , & devcontainerCLILogWriter {
307
307
ctx : ctx ,
308
308
logger : logger .With (slog .F ("stderr" , true )),
309
309
writer : io .Discard ,
0 commit comments