Closed otreblan closed 4 years ago
Nice work here.
I would have preferred 2 branches for the 2 separate features but it's not too dramatic.
That's quite a nice feature.
Tested your branch with different term settings.
The good: it even works flawlessly with TERM=vt320
on actual hardware terminal.
The bad: it totally messes the input with TERM=dumb
. At every prompt each key stroke is multiplied by the number of previous prompt having occured before. Furthermore, backspace doesn't work.
So we'd need to have a fallback to readline
for this latter use-case (like we do for the splash logo).
I'm not super fan of having the input()
method as well as the inputSession
/ completer
vars as properties of AiDungeon
class. We should restrict this class to game state and game logic.
Maintaining separation of concerns is key if we want to keep our sanity while this project grows.
For now, all the user input / output stuff is above under the # UTILS: TERMINAL
comment.
We could start wrapping this up into a dedicated class instead of relying on global vars.
Please note that https://github.com/Eigenbahn/ai-dungeon-cli/pull/9 suggests using the package as a lib and using setters to override these user interaction functions. This would allow building stuff such as chat bots.