bchao1 / bullet

🚅 Interactive prompts made simple. Build a prompt like stacking blocks.
https://pypi.org/project/bullet/
MIT License
3.55k stars 113 forks source link

Refactor key handling into declarative methods #20

Closed rcfox closed 5 years ago

rcfox commented 5 years ago

The current scheme doesn't allow for easily extending a class to handle new keys. I've refactored the key handling into functions, and added a decorator/metaclass to easily declare which key a method handles.

This is a more general approach to #10.

cs01 commented 5 years ago

this also fixes https://github.com/Mckinsey666/bullet/issues/15

bchao1 commented 5 years ago

This is amazing. I'll dig into this soon ( been busy lately since new semester just started).

bchao1 commented 5 years ago

Again, this is awesome! This refactorization is way more clean than the initial approach.