Skip to main content
Module

x/cliffy/prompt/mod.ts>PromptMiddleware

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

Prompt middleware function.

import { prompt } from "./prompt.ts";
import { Input } from "./input.ts";

const result = await prompt([{
  name: "name",
  message: "Project name",
  type: Input,
  async after({ name }, next) {
    // name prompt executed.
    await next();
    // path prompt executed.
  }
}, {
  name: "path",
  message: "Project path",
  type: Input,
  async before({ name }, next) {
    // name prompt executed.
    await next();
    // path prompt executed.
  }
}]);
definition: (result: TResult, next: Next<Exclude<keyof TResult, symbol>>) => void | Promise<void>