Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to re-implement history saving, closing #23 by implementing last missing feature on that issue.
These changes are still in a very early stage, currently we are capable of creating history file (it is being created at data directory and is named
neosh_history
, e.g. this is the path in *nix systems:~/.local/share/neosh/neosh_history
) and saving it.We are saving everything we can right now, that means we are saving built-in commands history with their exit codes (some of them are hard-coded to
0
at the moment due to their nature, e.g.echo
orpwd
), Lua chunks (NeoSH stdlib, Lua stdlib, functions, variables declaration, etc) and failed Lua commands.Missing functionalities to be added before merging:
history::get
to return a vector with each history line instead of returning history as a string (this can be really hard for Lua chunks with incomplete input like functions in multiple lines).Up
andDown
arrow keys insrc/core/input.rs
to browse history, whereUp
gets previous history entry andDown
gets the next one, like BASH or ZSH.Notes:
Page Up
andPage Down
keys to do the same thing as theUp
andDown
arrow keys like in ZSH.