Skip to content

Commit 9cf02a6

Browse files
committed
Update documentation
1 parent c756bf2 commit 9cf02a6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ To configure the command a option function will be passed which receives the com
3232

3333
Default option functions:
3434

35+
- `cmd.WithCustomBaseCommand(*exec.Cmd)`
3536
- `cmd.WithStandardStreams`
3637
- `cmd.WithCustomStdout(...io.Writers)`
3738
- `cmd.WithCustomStderr(...io.Writers)`

command.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ func NewCommand(cmd string, options ...func(*Command)) *Command {
7272
return c
7373
}
7474

75+
// WithCustomBaseCommand allows the OS specific generated baseCommand
76+
// to be overridden by an *os/exec.Cmd.
77+
//
78+
// Example:
79+
//
80+
// c := cmd.NewCommand(
81+
// "echo hello",
82+
// cmd.WithCustomBaseCommand(exec.Command("/bin/bash", "-c")),
83+
// )
84+
// c.Execute()
85+
//
7586
func WithCustomBaseCommand(baseCommand *exec.Cmd) func(c *Command) {
7687
return func(c *Command) {
7788
baseCommand.Args = append(baseCommand.Args, c.Command)

0 commit comments

Comments
 (0)