| 67 | }; |
| 68 | |
| 69 | export interface ClackSettings { |
| 70 | /** |
| 71 | * Set custom global aliases for the default actions. |
| 72 | * This will not overwrite existing aliases, it will only add new ones! |
| 73 | * |
| 74 | * @param aliases - An object that maps aliases to actions |
| 75 | * @default { k: 'up', j: 'down', h: 'left', l: 'right', '\x03': 'cancel', 'escape': 'cancel' } |
| 76 | */ |
| 77 | aliases?: Record<string, Action>; |
| 78 | |
| 79 | /** |
| 80 | * Custom messages for prompts |
| 81 | */ |
| 82 | messages?: { |
| 83 | /** |
| 84 | * Custom message to display when a spinner is cancelled |
| 85 | * @default "Canceled" |
| 86 | */ |
| 87 | cancel?: string; |
| 88 | /** |
| 89 | * Custom message to display when a spinner encounters an error |
| 90 | * @default "Something went wrong" |
| 91 | */ |
| 92 | error?: string; |
| 93 | }; |
| 94 | |
| 95 | withGuide?: boolean; |
| 96 | |
| 97 | /** |
| 98 | * Date prompt localization |
| 99 | */ |
| 100 | date?: { |
| 101 | /** Month names for validation messages (January, February, ...) */ |
| 102 | monthNames?: string[]; |
| 103 | messages?: { |
| 104 | /** Shown when date is missing */ |
| 105 | required?: string; |
| 106 | /** Shown when month > 12 */ |
| 107 | invalidMonth?: string; |
| 108 | /** (days, monthName) => message for invalid day */ |
| 109 | invalidDay?: (days: number, month: string) => string; |
| 110 | /** (min) => message when date is before minDate */ |
| 111 | afterMin?: (min: Date) => string; |
| 112 | /** (max) => message when date is after maxDate */ |
| 113 | beforeMax?: (max: Date) => string; |
| 114 | }; |
| 115 | }; |
| 116 | } |
| 117 | |
| 118 | export function updateSettings(updates: ClackSettings) { |
| 119 | // Handle each property in the updates |
nothing calls this directly
no outgoing calls
no test coverage detected