( flags: InputItemFlags, ...alternateInputProcessors: InputProcessor<I>[] )
| 11 | export type InputItemFlags = InputProcessorFlags |
| 12 | export const inputItemBuilder = inputProcessorBuilder |
| 13 | export async function inputItem<I extends object>( |
| 14 | flags: InputItemFlags, |
| 15 | ...alternateInputProcessors: InputProcessor<I>[] |
| 16 | ): Promise<[I, IOFormat]> { |
| 17 | const inputProcessor = buildInputProcessor<I>(flags, ...alternateInputProcessors) |
| 18 | const hasInputResult = inputProcessor.hasInput() |
| 19 | const hasInput = typeof hasInputResult === 'boolean' ? hasInputResult : await hasInputResult |
| 20 | if (hasInput) { |
| 21 | const item = await inputProcessor.read() |
| 22 | return [item, inputProcessor.ioFormat] |
| 23 | } else { |
| 24 | return fatalError('input is required either via file specified with --input option or from stdin') |
| 25 | } |
| 26 | } |
no test coverage detected