(name: string, options?: StringDefOptions)
| 44 | validate?: InputDefinitionValidateFunction<string> |
| 45 | } |
| 46 | export const optionalStringDef = (name: string, options?: StringDefOptions): InputDefinition<string | undefined> => { |
| 47 | const buildFromUserInput = async (context?: unknown[]): Promise<string | undefined> => |
| 48 | optionalStringInput(`${name} (optional)`, { |
| 49 | ...options, |
| 50 | default: defaultWithContextFn(options?.default, context), |
| 51 | validate: validateWithContextFn(options?.validate, context), |
| 52 | }) |
| 53 | const summarizeForEdit = (value: string): string => value |
| 54 | const updateFromUserInput = (original: string, context?: unknown[]): Promise<string | undefined> => |
| 55 | optionalStringInput(`${name} (optional)`, |
| 56 | { ...options, default: original, validate: validateWithContextFn(options?.validate, context) }) |
| 57 | |
| 58 | return { name, buildFromUserInput, summarizeForEdit, updateFromUserInput } |
| 59 | } |
| 60 | |
| 61 | export const stringDef = (name: string, options?: StringDefOptions): InputDefinition<string> => { |
| 62 | const buildFromUserInput = async (context?: unknown[]): Promise<string> => |
no outgoing calls
no test coverage detected