Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved documentation #34

Closed
xmatthias opened this issue Jan 29, 2020 · 2 comments
Closed

Improved documentation #34

xmatthias opened this issue Jan 29, 2020 · 2 comments
Labels
Documentation Enhancement New feature or request

Comments

@xmatthias
Copy link
Contributor

I think this is a great library - however documentation is somewhat lacking.

I've been able to build up a rather nice workflow now - but most of it i had to piece together from the sourcecode.

Mainly, it's about the configuration dictionary way:

from questionary import Separator, prompt
questions = [
        {
            "type": "confirm",
            "name": "conditional_step",
            "message": "Would you like the next question?",
            "default": True,
        },
       {
            "type": "text",
            "name": "next_question",
            "message": "Name this library?",
            "when": lambda x: x['conditional_step'],
            "validate": lambda val: val == "questionary"
        },
       {
            "type": "select",
            "name": "second_question",
            "message": "Select item",
            "choices": [
                "item1",
                "item2",
                Separator(),
                "other",
            ],
        },
        {
            "type": "text",
            "name": "second_question",
            "message": "Insert free text",
            "when": lambda x: x["second_question"] == "other"
        },
]
prompt(questions)

For the above dictionary - the following points are missing / non-obvious in the docs

  • "validate": key name when used as dictionary
  • `"validate": can be a function, does not have to be a ValidatorClass
  • "when": conditional - the readme.md only points this out as "skipif"
  • "second_question": Names can be reused in this way, to offer "choices" - or a "other" - free text form - which will end in the same dictionary key - "second_question" in the above example.

While the examples cover some of this - i think it would be better to have these very cool and important features documented properly.

@tmbo
Copy link
Owner

tmbo commented Jan 30, 2020

@xmatthias that is great feedback, thanks a lot. Given that your experience is still fresh, do you mind proposing the changes to the Readme?

Maybe pointing towards the examples more could help (and adding more comments in there)

@xmatthias
Copy link
Contributor Author

I guess i'll close this as #38 has been merged - and it includes what i personally was missing (not sure if other things are missing too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants