Closed yaleman closed 1 month ago
Hi @yaleman, thank you for the PR!
I have looked at the questionary codebase, and when a keyboard interrupt is captured during a questionary.prompt() call, there is an inconsistency between the documentation (should return None
) and codebase for questionary (actually returns {}
).
I have opened an issue here: https://github.com/tmbo/questionary/issues/385
I would propose that instead, we do two things:
answers = questionary.prompt(questions,kbi_msg="User did not answer all of the prompt questions. Exiting...")
That'd work as well 😄 Apologies for the epic reformat, my defaults in VS code are a little different, can clean that up when I go back to make changes.
We don't even have to check for {} / None
, it can just be if not answers
which does the same.
The catch-nothing exception sounds sensible, if I should create a new one please suggest a name, or one that will be handled (because the KeyError
wasn't 😄 )
Cleaned up the commit and made the handling a little cleaner (turns out, vs-code has a "save without formatting option").
I am still waiting on some feedback on the Issue I created in the questionary repo: https://github.com/splunk/contentctl/pull/189#:~:text=tmbo/questionary%23385
I have decided we will merge this in, as your updated changes handle both cases {}
and None
.
I will keep an eye on the linked questionary issue above.
I have updated this to go into v4.2 which we expect to release soon rather than directly into main
.
If you ran
contentctl new
and hit ctrl-c it'd end up throwing a slightly confusing error: