Skip to content

Commit

Permalink
docs: Added example usage of cli.promptInput() to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodeah committed Mar 22, 2021
1 parent 64bdc14 commit 6c54a87
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,16 @@ cli.addCommand("order", async (flags) => {
cli.log("Pick a dish:")
const dishIndex = await cli.promptMenu(dishes.map((dish) => `${dish.name} - $${dish.price}`));

cli.log(
$.BOLD + "Great!",
$.GREEN + "$" + (dishes[dishIndex].price),
$.CLEAR + "has been withdrawn from your card and your food is being prepared...",
);
const confirmationResponse = await cli.promptInput("Are you sure? (yes/no)");
if(confirmationResponse.toLowerCase() === "yes") {
cli.log(
$.BOLD + "Great!",
$.GREEN + "$" + (dishes[dishIndex].price),
$.CLEAR + "has been withdrawn from your card and your food is being prepared...",
);
} else {
cli.log($.RED + "Order cancelled.");
}
})
.addFlag("address", "string", true);
```
Expand Down

0 comments on commit 6c54a87

Please sign in to comment.