Skip to content

Commit 3687877

Browse files
committed
cmd: make run setting key enum values public
Make the 'settingType' values used to configure behavior in 'CommandExecutor.Run()' public so that they can be used outside the 'git' package (namely, in unit tests added in a later patch). Signed-off-by: Victoria Dye <[email protected]>
1 parent acc45b3 commit 3687877

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

internal/cmd/command.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ func (c *commandExecutor) buildCmd(ctx context.Context, command string, args ...
3939
func (c *commandExecutor) applyOptions(ctx context.Context, cmd *exec.Cmd, settings []Setting) {
4040
for _, setting := range settings {
4141
switch setting.Key {
42-
case stdinKey:
42+
case StdinKey:
4343
cmd.Stdin = setting.Value.(io.Reader)
44-
case stdoutKey:
44+
case StdoutKey:
4545
cmd.Stdout = setting.Value.(io.Writer)
46-
case stderrKey:
46+
case StderrKey:
4747
cmd.Stderr = setting.Value.(io.Writer)
48-
case envKey:
48+
case EnvKey:
4949
env, ok := setting.Value.([]string)
5050
if !ok {
5151
panic("incorrect env setting type")

internal/cmd/settings.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@ import (
99
type settingType int
1010

1111
const (
12-
stdinKey settingType = iota
13-
stdoutKey
14-
stderrKey
15-
envKey
12+
StdinKey settingType = iota
13+
StdoutKey
14+
StderrKey
15+
EnvKey
1616
)
1717

1818
type Setting utils.KeyValue[settingType, any]
1919

2020
func Stdin(stdin io.Reader) Setting {
2121
return Setting{
22-
stdinKey,
22+
StdinKey,
2323
stdin,
2424
}
2525
}
2626

2727
func Stdout(stdout io.Writer) Setting {
2828
return Setting{
29-
stdoutKey,
29+
StdoutKey,
3030
stdout,
3131
}
3232
}
3333

3434
func Stderr(stderr io.Writer) Setting {
3535
return Setting{
36-
stderrKey,
36+
StderrKey,
3737
stderr,
3838
}
3939
}
4040

4141
func Env(env []string) Setting {
4242
return Setting{
43-
envKey,
43+
EnvKey,
4444
env,
4545
}
4646
}

0 commit comments

Comments
 (0)