Module scriptlike.interact
Handling of interaction with users via standard input.
Provides functions for simple and common interactions with users in the form of question and answer.
Synopsis
import scriptlike.interact; auto age = userInput!int("Please Enter you age"); if(userInput!bool("Do you want to continue?")) { auto outputFolder = pathLocation("Where you do want to place the output?"); auto color = menu!string("What color would you like to use?", ["Blue", "Green"]); } auto num = require!(int, "a > 0 && a <= 10")("Enter a number from 1 to 10");
Functions
Name | Description |
---|---|
menu
|
Creates a menu from a Range of strings.
|
pathLocation
|
Gets a valid path folder from the user. The string will not contain quotes, if you are using in a system call and the path contain spaces wrapping in quotes may be required. |
pause
|
Pauses and prompts the user to press Enter (or "Return" on OSX). |
require
|
Requires that a value be provided and valid based on the delegate passed in. It must also check against null input. |
userInput
|
The userInput function provides a means to accessing a single
value from the user. Each invocation outputs a provided
statement/question and takes an entire line of input. The result is then
converted to the requested type; default is a string.
|
Classes
Name | Description |
---|---|
NoInputException
|
Used when input was not provided. |
Enum values
Name | Type | Description |
---|---|---|
defaultPausePrompt
|
Authors
Jesse Phillips
Copyright
Copyright Jesse Phillips 2010