CITGuru / PyInquirer

A Python module for common interactive command line user interfaces
MIT License
1.94k stars 236 forks source link

default type doesn't work #12

Closed alexakarpov closed 6 years ago

alexakarpov commented 6 years ago

Hi all,

The README claims that 'type' key is optional for questions; it appear this statement is not true: Running with a list of questions of this form:

questions = [
    {                                                                                              
        'type': 'input',
        'name': 'NAME',
        'message': 'Name:'
     },                                                                                           
    {
        'name': 'ASV',
        'message': 'ASV:'
     }
]

answers = prompt(questions)

leads to this interaction

? Name:  qwe
Traceback (most recent call last):
  File "./work.py", line 63, in <module>
    answers = prompt(questions)
  File "/usr/local/lib/python2.7/site-packages/PyInquirer/prompt.py", line 27, in prompt
    raise PromptParameterException('type')
PyInquirer.PromptParameterException: ('You must provide a `type` value', None)
CITGuru commented 6 years ago

I think we need to update some part of the README.

CITGuru commented 6 years ago

Can you point out where that is mentioned. You need to provide a type for every question

CITGuru commented 6 years ago

I dont think that is mentioned in the README, I just looked through it lines by lines.

alexakarpov commented 6 years ago

sorry for the lag; I meant this line (perhaps I misunderstood it?):

type: (String) Type of the prompt. Defaults: input - Possible values: input, confirm, list, rawlist, expand, checkbox, password, editor

CITGuru commented 6 years ago

Yea, I think that can also lead people astray. Unless we could add such functionality, but to make things clear, I'll just leave it to need a type by default.