implement History::truncate#1082
Conversation
| /// remove an item from this history | ||
| fn delete(&mut self, h: HistoryItemId) -> Result<()>; | ||
| /// remove all history items, except the `keep` newest entries | ||
| fn delete_old(&mut self, keep: usize) -> Result<usize>; |
There was a problem hiding this comment.
Do you think truncate is a better name for this?
There was a problem hiding this comment.
I'd vote for it.
| } | ||
|
|
||
| /// get the raw value from this session id | ||
| pub fn as_raw(&self) -> i64 { |
There was a problem hiding this comment.
Do I understand this right that first of all it has no consumers and secondly could be achieved by i64::from(session)?
Seems redundant and unused.
There was a problem hiding this comment.
that's correct, I completely missed the From<HistorySessionId> for i64
|
Don't forget to run |
|
Pushed a failing test |
|
Having a file history with multiple sessions is significantly more complicated then I though. If I understand correctly, will not be possible to implement nushell/nushell#18235 correctly with the current architecture. Example of archival not triggering correctly:
Nushell will only be able to call I will mark this PR as draft for now, fell free to close it. I'll probably create new one if I came up with an idea that don't require a big rewrite. |
Function used to remove multiple old history entries.