/** * Copyright 2023 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type inquirer from "inquirer"; import type { DistinctQuestion } from "inquirer"; type ConfirmArg = DistinctQuestion & { message: string; flagName?: string | undefined; }; export declare const confirm: ({ flagName, ...question }: ConfirmArg) => Promise; export type InputArg = DistinctQuestion & { message: string; flagName?: string | undefined; }; export declare const input: (question: InputArg) => Promise; type PasswordArg = DistinctQuestion & { message: string; flagName?: string | undefined; }; export declare const password: (question: PasswordArg) => Promise; type Separator = typeof inquirer.Separator; type SeparatorObj = InstanceType; export type Choices = [T] extends [string] ? Array : Array<{ value: T; name: string; } | SeparatorObj>; type ListOptions = DistinctQuestion & { /** * Choices to choose from * can be either an array of strings or an array of objects with `value` and `name` properties */ options: Choices; /** * Message to print to when there are multiple choices */ message: string; /** * Runs when there is only one choice * @param {string} choice - the only choice * @returns a message to print to the user when there is only one choice */ oneChoiceMessage: (choice: string) => string; /** * Runs when there are no choices and if there was one choice and user refused to use it * @returns value to return if there are no choices */ onNoChoices: () => U; /** * Flag name to use if user can't be prompted because he uses cli in non-interactive mode */ flagName?: string | undefined; default?: T; }; export declare const list: (listOptions: ListOptions) => Promise; export declare const checkboxes: (listOptions: ListOptions) => Promise; export {};