@@ -92,6 +92,9 @@ func (c *config) build() *Command {
9292// Successive calls will simply overwrite any previous calls. Without this option
9393// the command will default to [os.Stdin].
9494//
95+ // Subcommands cannot override the stdin of the root command, when retrieving the
96+ // stdin with [Command.Stdin], the root's stdin will be returned.
97+ //
9598// // Set stdin to os.Stdin (the default anyway)
9699// cli.New("test", cli.Stdin(os.Stdin))
97100func Stdin (stdin io.Reader ) Option {
@@ -113,6 +116,9 @@ func Stdin(stdin io.Reader) Option {
113116// Successive calls will simply overwrite any previous calls. Without this option
114117// the command will default to [os.Stdout].
115118//
119+ // Subcommands cannot override the stdout of the root command, when retrieving the
120+ // stdout with [Command.Stdout], the root's stdout will be returned.
121+ //
116122// // Set stdout to a temporary buffer
117123// buf := &bytes.Buffer{}
118124// cli.New("test", cli.Stdout(buf))
@@ -135,6 +141,9 @@ func Stdout(stdout io.Writer) Option {
135141// Successive calls will simply overwrite any previous calls. Without this option
136142// the command will default to [os.Stderr].
137143//
144+ // Subcommands cannot override the stderr of the root command, when retrieving the
145+ // stdin with [Command.Stderr], the root's stderr will be returned.
146+ //
138147// // Set stderr to a temporary buffer
139148// buf := &bytes.Buffer{}
140149// cli.New("test", cli.Stderr(buf))
0 commit comments