It seems that the default
-key is ignored on list-type questions
Consider the following code:
from PyInquirer import prompt, print_json answer = prompt({ 'type': 'list', 'name': "test-question", 'message': "Select item", 'default': 2, 'choices': [ { "name" : "Item 1", "value" : "item1" }, { "name" : "Item 2", "value" : "item2" }, { "name" : "Item 3", "value" : "item3" }, { "name" : "Item 4", "value" : "item4" }, ] }) print_json(answer)Expected result:
Item 3
is initially selected in the prompt
Item 1
is initially selected in the prompt
OS: macOS 10.14 Mojave
$ python3 --version Python 3.6.1
$ python3 -m pip show PyInquirer Name: PyInquirer Version: 1.0.2 Summary: A Python module for collection of common interactive command line user interfaces, based on Inquirer.js Home-page: https://github.com/CITGuru/PyInquirer/ Author: Oyetoke Toby Author-email: oyetoketoby80@gmail.com License: MIT Location: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages Requires: prompt-toolkit, Pygments, regex Required-by:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4