import { type IdRetrievalFunction, type ListDataFunction, type LookupDataFunction, type Naming, type Sorting } from './io-defs.js'; import { type OutputListConfig } from './output-list.js'; import { type SmartThingsCommand } from './smartthings-command.js'; import { BuildOutputFormatterFlags } from './output-builder.js'; export type SelectFromListConfig = Sorting & Naming & OutputListConfig; export declare const indefiniteArticleFor: (name: string) => string; export type PromptUserFlags = BuildOutputFormatterFlags; export declare const promptUserBuilder: (yargs: import("yargs").Argv) => import("yargs").Argv; export type PromptUserOptions = { /** * A function that returns the list of items to display. */ listItems: ListDataFunction; /** * The method that will prompt the user for an item from the list. * * @default `stringGetIdFromUser` which is usually the right option unless `ID` is not `string` */ getIdFromUser?: IdRetrievalFunction; /** * A message to display to the user when prompting for their choice (this is passed to * `getIdFromUser`). * * @default prompt is generated automatically using `itemName` from the corresponding config * as "Select a(n) ". If no `itemName` is specified, `undefined` is passed to * `getIdFromUser`. (The default `getIdFromUser`, `stringGetIdFromUser`, uses * "Enter id or index" when not prompt is specified.) */ promptMessage?: string; /** * Set this to true if you want to automatically choose for the user if `listItems` returns * exactly one item. * * @default: false */ autoChoose?: boolean; /** * A custom error message to display when no items are found. */ customNotFoundMessage?: string; }; /** * Display a list of items and ask the user to choose one. You probably want to use * `selectFromList` instead which also allows for a preselected id (usually from the command line). * * @param command The command that is requesting the selection. * @param config Configuration for primary key, sorting key and fields to display when asking the user for a selection. * @param options More parameters bundled in an object for readability. * @returns Selected id if one was chosen. Logs message if no items are found and exits. */ export declare function promptUser(command: SmartThingsCommand, config: SelectFromListConfig, options: PromptUserOptions): Promise; export type SelectFromListFlags = PromptUserFlags; export declare const selectFromListBuilder: (yargs: import("yargs").Argv) => import("yargs").Argv; export type SelectOptions = PromptUserOptions & { /** * If the value passed here is truthy, it is returned and no further processing is done. */ preselectedId?: ID; /** * Specify this if you want to allow the user to save their answer as a default. (Including * this will also use that default rather than prompting the user if one has been set.) */ defaultValue?: { /** * The key name in the config file to use. */ configKey: string; /** * This method will be called to verify the saved id is still valid and inform the user it * is being used if so. * * The item is considered invalid if this method returns undefined or throws axios exception * with a status code of 403 or 404. */ getItem: LookupDataFunction; /** * This function should return a message to display to the user when the default value is * found and used. */ userMessage: (item: L) => string; }; }; /** * Process selection of an item from a list. Uses `preselectedId` if it is defined and asks the * user to choose from items returned by `listItems` if not. * * @param command The command that is requesting the selection. * @param config Configuration for primary key, sorting key and fields to display when asking the user for a selection. * @param options More parameters bundled in an object for readability. * @returns Selected id if one was chosen. Logs message if no items are found and exits. */ export declare function selectFromList(command: SmartThingsCommand, config: SelectFromListConfig, options: SelectOptions): Promise; //# sourceMappingURL=select.d.ts.map