import { inject } from "https://deno.land/x/cliffy@v1.0.0-rc.3/prompt/mod.ts";
Inject prompt values. Can be used for unit tests.
In the following example, the prompt()
method only asks for the color.
The values for name' and
age' are selected from the values injected by the
`inject()' method and the prompts are skipped.
import { inject, prompt } from "./prompt.ts";
import { Input } from "./input.ts";
import { Number } from "./number.ts";
import { Confirm } from "./confirm.ts";
import { Checkbox } from "./checkbox.ts";
inject({
name: "Joe",
age: 34,
});
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"],
}]);