(name: string, options?: StringDefOptions)
| 59 | } |
| 60 | |
| 61 | export const stringDef = (name: string, options?: StringDefOptions): InputDefinition<string> => { |
| 62 | const buildFromUserInput = async (context?: unknown[]): Promise<string> => |
| 63 | stringInput(name, |
| 64 | { |
| 65 | ...options, |
| 66 | default: defaultWithContextFn(options?.default, context), |
| 67 | validate: validateWithContextFn(options?.validate, context), |
| 68 | }) |
| 69 | const summarizeForEdit = (value: string): string => value |
| 70 | const updateFromUserInput = (original: string, context?: unknown[]): Promise<string> => |
| 71 | stringInput(name, |
| 72 | { ...options, default: original, validate: validateWithContextFn(options?.validate, context) }) |
| 73 | |
| 74 | return { name, buildFromUserInput, summarizeForEdit, updateFromUserInput } |
| 75 | } |
| 76 | |
| 77 | export type NumberDefOptions = Omit<IntegerInputOptions<number>, 'default'> & { |
| 78 | default?: InputDefinitionDefaultValueOrFn<number> |
no outgoing calls
no test coverage detected