prompt
Utilities for helping build interactive prompts
confirm(default)
Confirm that the user wishes to continue
Parameters:
Name | Type | Description | Default |
---|---|---|---|
default |
bool
|
Whether the default selection should be True (yes) or False (no) |
required |
Returns:
Type | Description |
---|---|
bool
|
Whether the user has opted to continue |
Source code in enderchest/prompt.py
prompt(message, suggestion=None, is_password=False)
Prompt the user and return the response
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
The prompt message |
required |
suggestion |
str
|
A suggested input. If None is provided, no suggestion will be shown. |
None
|
is_password |
bool
|
If this is a prompt for a password, pass in |
False
|
Returns:
Type | Description |
---|---|
str
|
The user-provided response |
Notes
- The output will be stripped of trailing and leading whitespace, but no other validation or processing will be used.
- Regardless of whether a suggestion is provided, if the user provides an empty input, this method will return an empty string. To reiterate: the suggestion does not serve as a default / fallback value.