Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support flushing command history #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nkartashov
Copy link

@nkartashov nkartashov commented Feb 2, 2016

Previously command history was only flushed after the end of a session,
this commit adds flushHistory function which performs the flushing and
a flag to enforce flushing after every command.

Fixes issue #5


This change is Reviewable

Previously command history was only flushed after the end of session,
this commit adds flushHistory function which performs the flushing and
a flag to enforce flushing after every command.
@nkartashov
Copy link
Author

You are probably right, I'll move it to Prefs.
Will modify comments to be more descriptive.

Previously command history was only flushed after the end of session,
this commit adds flushHistory function which performs the flushing and
a flag to Prefs to enforce flushing after every command.
@nkartashov
Copy link
Author

Sorry for not fixing such trivial problems earlier, do you like how the code looks now?

@judah
Copy link
Collaborator

judah commented Mar 6, 2016

One other thing you might want to think about is what the right behavior is when there's multiple sessions open at once; see for example:
http://superuser.com/questions/211966/how-do-i-keep-my-bash-history-across-sessions
You might want to append to the history file rather than just dumping the current session's history and overwriting everything else.

Up to you, and not necessary to do for this pull request.

@lukaszlew
Copy link

We should indeed append instead of overwriting.
Another bash reference

@414owen
Copy link

414owen commented Nov 24, 2020

@nkartashov I've added a preferences option, and implemented append-mode writing, in this branch:
https://github.com/414owen/haskeline/tree/history-flushing-tweaks
You're welcome to merge those changes into this pr

Update: see #148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants