Skip to content

Commit

Permalink
(examples) add example for any, numeric and choice types (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
disizali committed Jul 13, 2020
1 parent 0fb6aee commit d6dd61c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions examples/interactive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Interaction, InteractType } from "../mod.ts";

//TODO: make prefix,suffix,bold,... global configurable:
const interaction = new Interaction();

const results = await interaction.interact([
{
name: "name",
message: "enter your name",
type: InteractType.any,
prefix: "> ",
suffix: ": ",
bold: true,
},
{
name: "age",
message: "enter your age",
type: InteractType.numeric,
prefix: "> ",
suffix: ": ",
bold: true,
},
{
name: "pizza",
message: "enter your favorite food",
type: InteractType.choice,
options: ["pizza", "hamburger"],
prefix: "> ",
suffix: ": ",
bold: true,
},
]);

console.log(results);

0 comments on commit d6dd61c

Please sign in to comment.