Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/cliffy/prompt/prompt.ts>prompt

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
function prompt
import { prompt } from "https://deno.land/x/cliffy@v1.0.0-rc.1/prompt/prompt.ts";

Runs an array of prompts.

import { prompt } from "./prompt.ts";
import { Input } from "./input.ts";
import { Confirm } from "./confirm.ts";
import { Checkbox } from "./checkbox.ts";

const result = await prompt([{
  name: "name",
  message: "What's your name?",
  type: Input,
}, {
  name: "age",
  message: "How old are you?",
  type: Confirm,
}, {
  name: "color",
  message: "Whats your favorit color?",
  type: Checkbox,
  options: ["red", "green", "blue"],
}]);

console.log(result);

Type Parameters

TName0 extends string
TName1 extends string
TName2 extends string
TName3 extends string
TName4 extends string
TName5 extends string
TName6 extends string
TName7 extends string
TName8 extends string
TName9 extends string
TName10 extends string
TName11 extends string
TName12 extends string
TName13 extends string
TName14 extends string
TName15 extends string
TName16 extends string
TName17 extends string
TName18 extends string
TName19 extends string
TName20 extends string
TName21 extends string
TName22 extends string
TName23 extends string
TOptions0 extends GenericPromptOptions<any, any>
TOptions1 extends GenericPromptOptions<any, any>
TOptions2 extends GenericPromptOptions<any, any>
TOptions3 extends GenericPromptOptions<any, any>
TOptions4 extends GenericPromptOptions<any, any>
TOptions5 extends GenericPromptOptions<any, any>
TOptions6 extends GenericPromptOptions<any, any>
TOptions7 extends GenericPromptOptions<any, any>
TOptions8 extends GenericPromptOptions<any, any>
TOptions9 extends GenericPromptOptions<any, any>
TOptions10 extends GenericPromptOptions<any, any>
TOptions11 extends GenericPromptOptions<any, any>
TOptions12 extends GenericPromptOptions<any, any>
TOptions13 extends GenericPromptOptions<any, any>
TOptions14 extends GenericPromptOptions<any, any>
TOptions15 extends GenericPromptOptions<any, any>
TOptions16 extends GenericPromptOptions<any, any>
TOptions17 extends GenericPromptOptions<any, any>
TOptions18 extends GenericPromptOptions<any, any>
TOptions19 extends GenericPromptOptions<any, any>
TOptions20 extends GenericPromptOptions<any, any>
TOptions21 extends GenericPromptOptions<any, any>
TOptions22 extends GenericPromptOptions<any, any>
TOptions23 extends GenericPromptOptions<any, any>
TStaticPrompt0 extends StaticGenericPrompt<any, TOptions0>
TStaticPrompt1 extends StaticGenericPrompt<any, TOptions1>
TStaticPrompt2 extends StaticGenericPrompt<any, TOptions2>
TStaticPrompt3 extends StaticGenericPrompt<any, TOptions3>
TStaticPrompt4 extends StaticGenericPrompt<any, TOptions4>
TStaticPrompt5 extends StaticGenericPrompt<any, TOptions5>
TStaticPrompt6 extends StaticGenericPrompt<any, TOptions6>
TStaticPrompt7 extends StaticGenericPrompt<any, TOptions7>
TStaticPrompt8 extends StaticGenericPrompt<any, TOptions8>
TStaticPrompt9 extends StaticGenericPrompt<any, TOptions9>
TStaticPrompt10 extends StaticGenericPrompt<any, TOptions10>
TStaticPrompt11 extends StaticGenericPrompt<any, TOptions11>
TStaticPrompt12 extends StaticGenericPrompt<any, TOptions12>
TStaticPrompt13 extends StaticGenericPrompt<any, TOptions13>
TStaticPrompt14 extends StaticGenericPrompt<any, TOptions14>
TStaticPrompt15 extends StaticGenericPrompt<any, TOptions15>
TStaticPrompt16 extends StaticGenericPrompt<any, TOptions16>
TStaticPrompt17 extends StaticGenericPrompt<any, TOptions17>
TStaticPrompt18 extends StaticGenericPrompt<any, TOptions18>
TStaticPrompt19 extends StaticGenericPrompt<any, TOptions19>
TStaticPrompt20 extends StaticGenericPrompt<any, TOptions20>
TStaticPrompt21 extends StaticGenericPrompt<any, TOptions21>
TStaticPrompt22 extends StaticGenericPrompt<any, TOptions22>
TStaticPrompt23 extends StaticGenericPrompt<any, TOptions23>
optional
TResult = Id<
& PromptResult<TName0, TStaticPrompt0>
& PromptResult<TName1, TStaticPrompt1>
& PromptResult<TName2, TStaticPrompt2>
& PromptResult<TName3, TStaticPrompt3>
& PromptResult<TName4, TStaticPrompt4>
& PromptResult<TName5, TStaticPrompt5>
& PromptResult<TName6, TStaticPrompt6>
& PromptResult<TName7, TStaticPrompt7>
& PromptResult<TName8, TStaticPrompt8>
& PromptResult<TName9, TStaticPrompt9>
& PromptResult<TName10, TStaticPrompt10>
& PromptResult<TName11, TStaticPrompt11>
& PromptResult<TName12, TStaticPrompt12>
& PromptResult<TName13, TStaticPrompt13>
& PromptResult<TName14, TStaticPrompt14>
& PromptResult<TName15, TStaticPrompt15>
& PromptResult<TName16, TStaticPrompt16>
& PromptResult<TName17, TStaticPrompt17>
& PromptResult<TName18, TStaticPrompt18>
& PromptResult<TName19, TStaticPrompt19>
& PromptResult<TName20, TStaticPrompt20>
& PromptResult<TName21, TStaticPrompt21>
& PromptResult<TName22, TStaticPrompt22>
& PromptResult<TName23, TStaticPrompt23>
>

Parameters

prompts:
[]

Array of prompt options.

optional
options: GlobalPromptOptions<TResult>

Global prompt options.

Returns

Promise<TResult>

Returns an object with the result of all prompts.