diff --git a/README.md b/README.md index 3366a04..7cd11c6 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,28 @@ chmod +x install.sh --- +### 🔧 Configuration file + +The configuration file is available in the `.nshell` folder. +And he is downloaded from here: https://gist.github.com/onihilist/8bf7548dc7478f1b6af2db4bdc0c668d + +```json +{ + "configuration": { + "nshell": { + "history": [ + { + "expiration_time": "7d", + "max_storage": 500 + } + ] + } + } +} +``` + +--- + ### 🎨 Custom themes This is a little exemple of an custom theme.
diff --git a/Shell/History/HistoryManager.cs b/Shell/History/HistoryManager.cs index 02ec1cb..a7bbbfc 100644 --- a/Shell/History/HistoryManager.cs +++ b/Shell/History/HistoryManager.cs @@ -30,7 +30,13 @@ public HistoryManager(string? path = null) private void Load() { if (File.Exists(_historyPath)) + { _history.AddRange(File.ReadAllLines(_historyPath)); + } + else + { + File.Create(_historyPath).Close(); + } } /// @@ -51,6 +57,7 @@ public void Add(string command) { _history.Add(command); _currentIndex = _history.Count; + File.WriteAllLines(_historyPath, _history); } } diff --git a/Shell/Readline/KeyAction.cs b/Shell/Readline/KeyAction.cs index 9cd2c1c..6d886ac 100644 --- a/Shell/Readline/KeyAction.cs +++ b/Shell/Readline/KeyAction.cs @@ -300,7 +300,7 @@ private void MoveCursorWordRight() private void HandleHistorySearch() { - var search = new NShell.Shell.History.HistorySearch(_history); + var search = new History.HistorySearch(_history); var result = search.Search(_initCursorPos4Console); if (result != null)