prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.3k stars 714 forks source link

How to set the length of FileHistory? #513

Open liangxin1300 opened 7 years ago

liangxin1300 commented 7 years ago

Hi: I am trying to use prompt_toolkit in project crmsh; I'm using FileHistory to record the inputs; How to set the length of the history file, like what readline.set_history_length() does? Regards, Xin

jonathanslenders commented 7 years ago

Hi @liangxin1300,

Right now there is no way to configure the history size. You could of course create a custom History class and pass that instead. I'm not sure whether it's worth the effort to make this configurable. What is the reason you'd like to limit the length?

Related: fish also does not allow this to be configurable, but has a fixed size: https://github.com/fish-shell/fish-shell/issues/940

liangxin1300 commented 7 years ago

Thanks!