Interactive
Provides helpers to prompt users.
- Namespace:
- KpokPatagon.CLI
- Type:
- Class
- Public:
- Yes
- Protected:
- No
- Sealed:
- Yes
- Abstract:
- No
Methods
PromptInt
Prompts the user for an integer value.
- Signature:
public Int32 PromptInt(defaultValue, prompt, invalidMessage, minValue, maxValue)
Parameters
Name |
Type |
Summary |
defaultValue |
Nullable<Int32> |
Default value if nothing is entered. |
prompt |
String |
Prompt message. |
invalidMessage |
String |
Invalid message. |
minValue |
Int32 |
Minimum allowed value. |
maxValue |
Int32 |
Maximim allowed value. |
Exceptions
Type |
Summary |
OperationCanceledException |
Thrown when the user press Ctrl+C. |
PromptOption
Prompt the user for an option.
- Signature:
public Char PromptOption(defaultValue, options, prompt, invalidMessage, allowEmpty)
Parameters
Name |
Type |
Summary |
defaultValue |
Char |
Default value if nothing is entered. |
options |
Char[] |
Allowed options. |
prompt |
String |
Prompt message. |
invalidMessage |
String |
Invalid message. |
allowEmpty |
Boolean |
Whether an empty result is valid. |
Exceptions
Type |
Summary |
OperationCanceledException |
Thrown when the user press Ctrl+C. |
PromptPassword
Prompt the user for a password.
- Signature:
public String PromptPassword(defaultValue, prompt, promptConfirm, invalidConfirmMessage, allowEmpty)
Parameters
Name |
Type |
Summary |
defaultValue |
String |
Default value if nothing is entered. |
prompt |
String |
Prompt message. |
promptConfirm |
String |
Confirmation prompt message. |
invalidConfirmMessage |
String |
Invalid message for confirmation. |
allowEmpty |
Boolean |
Whether an empty result is valid. |
Exceptions
Type |
Summary |
OperationCanceledException |
Thrown when the user press Ctrl+C. |
PromptString
Prompts the user for a text.
- Signature:
public String PromptString(defaultValue, prompt, invalidMessage, allowEmpty)
Parameters
Name |
Type |
Summary |
defaultValue |
String |
Default value if nothing is entered. |
prompt |
String |
Prompt message. |
invalidMessage |
String |
Invalid message. |
allowEmpty |
Boolean |
Whether an empty result is valid. |
Exceptions
Type |
Summary |
OperationCanceledException |
Thrown when the user press Ctrl+C. |