markfink / whaaaaat

Inquirer.js port to Python (https://www.npmjs.com/package/inquirer). people blame me for staling this project. I do not have time to work on this right now - whaaaaat do you want me to do? take it offline?
MIT License
83 stars 9 forks source link

default function #6

Closed rog555 closed 6 years ago

rog555 commented 6 years ago

hi, awesome package!

is a function supplied to "default" supposed to work?

>>> from whaaaaat import prompt
>>> prompt({'name':'test','type':'input','message':'test','default':lambda a: 'DEFAULT'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/whaaaaat/prompt.py", line 57, in prompt
    application = getattr(prompts, type).question(message, **_kwargs)
  File "/Library/Python/2.7/site-packages/whaaaaat/prompts/input.py", line 47, in question
    **kwargs
  File "/Library/Python/2.7/site-packages/prompt_toolkit/shortcuts.py", line 500, in create_prompt_application
    initial_document=Document(default),
  File "/Library/Python/2.7/site-packages/prompt_toolkit/document.py", line 83, in __init__
    assert isinstance(text, six.text_type), 'Got %r' % text
AssertionError: Got <function <lambda> at 0x1055855f0>
rog555 commented 6 years ago

submitted PR https://github.com/finklabs/whaaaaat/pull/7

markfink commented 6 years ago

glad you like it. as I can see you have been busy. I am at the moment required by my day job so I can only try to take a look over the weekend. Please be aware that prompt-toolkit is undergoing major changes at the moment so this package might require some changes, too.