UNPKG

@stacksjs/clapp

Version:

A toolkit for building CLI prompts in TypeScript.

34 lines 1.06 kB
export declare function updateSettings(updates: ClappSettings): void; /** * Check if a key is an alias for a default action * @param key - The raw key which might match to an action * @param action - The action to match * @returns boolean */ export declare function isActionKey(key: string | Array<string | undefined>, action: Action): boolean; export declare const settings: InternalClappSettings; /** Global settings for Clapp programs, stored in memory */ declare interface InternalClappSettings { actions: Set<Action> aliases: Map<string, Action> messages: { cancel: string error: string } } export declare interface ClappSettings { aliases?: Record<string, Action> messages?: { /** * Custom message to display when a spinner is cancelled * @default "Canceled" */ cancel?: string /** * Custom message to display when a spinner encounters an error * @default "Something went wrong" */ error?: string } } export type Action = 'up' | 'down' | 'left' | 'right' | 'space' | 'enter' | 'cancel'