CITGuru / PyInquirer

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

Cancel? #6

Closed joveice closed 5 years ago

joveice commented 5 years ago

How would I go about catching CTRL + C here or is there some way to cancel a action, etc once entered a input how do you exit it (etc a interactive shell)

CITGuru commented 5 years ago

By default CTRL + C will exit the shell. There's no way to catch it from PyInquirer, but you can use KeyboardInterrupt or handle SIGNIT/SIGTERM. Can you elaborate what you want to achieve with this?

joveice commented 5 years ago

Interactive shell. I noticed that you already catch keyboardinterrupt and return a empty dict. so I'm just checking if the return is empty or not, if empty I just break out of the loop. Solves my issue.

CITGuru commented 5 years ago

Yea, that's also a good solution to this. :+1: