import { CommandTypesBase } from "../types/command.mjs"; import { OutputConfig } from "../output/output-indicator.mjs"; //#region src/extension/auto-output.d.ts type PadroneAutoOutputOptions = { /** Disable auto-output entirely. */disabled?: boolean; /** * Declarative output format for the command's return value. * When set, auto-output formats the return value through the specified primitive * instead of passing it raw to `runtime.output`. * Ignored when the action calls `ctx.context.output.*` explicitly. * * ```ts * // Format return value as a table * c.extend(padroneAutoOutput({ output: 'table' })) * * // Format with options * c.extend(padroneAutoOutput({ output: { type: 'table', options: { border: false } } })) * ``` */ output?: OutputConfig; /** * Automatically print unhandled errors to stderr in CLI mode. * Skips errors already handled by other extensions (routing, validation, signal). * @default true */ errorOutput?: boolean; }; /** * Extension that automatically writes a command's return value to output after execution. * * - Values are passed directly to the runtime's `output` function (no stringification). * - Promises are awaited before output. * - Iterators and async iterators are consumed, outputting each yielded value as it arrives. * The result is replaced with the collected array so `drain()` still works. * - `undefined` and `null` results produce no output. * * Also injects `ctx.context.output` with format-aware output primitives (table, tree, list, kv). * When action handlers use these methods, auto-output skips to avoid double output. * * Included in the default extensions. Can also be applied per-command: * ```ts * createPadrone('my-cli') * .command('users', (c) => * c.extend(padroneAutoOutput({ output: 'table' })) * .action(() => fetchUsers()) * ) * ``` */ declare function padroneAutoOutput(options?: PadroneAutoOutputOptions): (builder: T) => T; //#endregion export { PadroneAutoOutputOptions, padroneAutoOutput }; //# sourceMappingURL=auto-output.d.mts.map