Skip to content

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

@athas
Copy link
Collaborator

athas commented Feb 6, 2025

Closed in favour of #148.

@athas athas closed this Feb 6, 2025
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.

5 participants