Prompt Provider¶
Wraps PyInquirer python package for basic prompting.
Hooks¶
Type | Description | Return |
---|---|---|
checkbox | Hook for PyInquirer checkbox type prompts. Allows the user to multi-select from a list of choices and outputs a list. Takes in three forms of choices inputs. A list of string, a list of maps with all keys having a name field per the original spec, or list of maps with the key as the question, the value as the output. |
list |
confirm | Hook to confirm with a message and return a boolean. Source example | bool |
editor | Hook for PyInquirer editor type prompts. Opens an editor like nano to fill in a field. Source example |
bool |
expand | Hook for PyInquirer expand type prompt. Source example |
list |
input | Hook for PyInquirer 'input' type prompts. Allows the user to input a string input. Source example | str |
password | Hook for PyInquirer password type prompts. Masks the input as the user types it in. Source example |
str |
rawlist | Hook for PyInquirer 'rawlist' type prompts. Similar to select hook with lessflexibility. Source example |
list |
select | Hook for PyInquirer 'list' type prompts, a single selector that returns a string. Takes in two forms of choices inputs, list of string or list of maps with the key as the question and the value as the output. Source example |
Any |
Examples¶
input¶
Prompt that allows user to input a field.
compact_implicit->: input
compact_with_question->: input Ask a question?
input_expanded:
->: input
message: A question?
default: things
? compact_implicit >>>
? Ask a question?
? A question? things
compact_implicit: <user input>
compact_with_question: <user input>
input_expanded: <user input>
select¶
A selector that limits the input to a list of choices. Generally this is written in expanded form.
compact->: select "What do you want?" ['stuff','things']
expanded:
->: select
choices:
- stuff
- things
? What do you want? stuff
? expanded >>> (Use arrow keys)
stuff
❯ things
compact: stuff
expanded: things
checkbox¶
A checkbox that allow the user to chose multiple choices and returns a list of those choices.
checkbox-minimal:
->: input
choices:
- stuff
- things