Skip to content

createOutput

Generated reference page for the createOutput function export.

Signatures

ts
function createOutput(options?: OutputOptions): Out;
ParameterTypeDescription
optionsOutputOptions | undefinedOptional configuration. When omitted, output is
discarded (useful for silent test runs). Pass stdout/stderr
writers to direct output somewhere useful.

Members

Members

createOutput

Create an output channel.

Low-level factory: action handlers already receive out automatically from cli(), .execute(), and runCommand(). Call createOutput() when you are embedding DreamCLI primitives into a custom runtime or need a standalone output implementation outside the normal command pipeline.

ts
(options?: OutputOptions): Out;

Examples

ts
// Production (wired by the runtime adapter)
const out = createOutput({
  stdout: (s) => process.stdout.write(s),
  stderr: (s) => process.stderr.write(s),
  isTTY: process.stdout.isTTY === true,
});

// Test (capture output)
const lines: string[] = [];
const out = createOutput({
  stdout: (s) => lines.push(s),
  stderr: (s) => lines.push(s),
});

See Also

Released under the MIT License.