Add Sqlite option for PSReadline#4833
Open
jshigetomi wants to merge 9 commits intoPowerShell:masterfrom
Open
Conversation
6487646 to
38497d6
Compare
2 tasks
89722ca to
8d026f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Summary
This pull request adds support for storing command history in a SQLite database as an alternative to the traditional text file in PSReadLine. It introduces new options for configuring history storage, updates the build and packaging process to include required SQLite dependencies, and makes the history system more flexible and extensible. The changes ensure that users can choose between text and SQLite-based history, and that the correct files are managed and loaded depending on the selected mode.
Key changes include:
SQLite History Support and Configuration:
Introduced a new
HistoryTypeenum with options forTextandSQLite, and updated thePSConsoleReadLineOptionsclass to support selecting the history type (HistoryTypeproperty, defaulting to text). The active history save path is now determined by the selected type, with separate properties for text and SQLite paths (HistorySavePathText,HistorySavePathSQLite). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Updated
SetPSReadLineOptionand internal logic to handle switching between history types, including initializing the SQLite database, migrating text history, and reloading history as needed. [1] [2]Adjusted history reading and writing logic to respect the selected history type, including passing the current location for SQLite history entries and only reading the text history file if in text mode. [1] [2] [3]
Build and Packaging Updates:
Modified the build process to restructure native SQLite DLLs into a layout compatible with PowerShell's native DLL handler, and ensured all necessary managed and native SQLite dependencies are copied to the output and layout directories. [1] [2]
Updated project file to include
Microsoft.Data.SqliteandSQLitePCLRaw.bundle_e_sqlite3as dependencies, and enabledCopyLocalLockFileAssembliesfor proper DLL deployment.Changed the NuGet configuration to use the official
nuget.orgfeed.User Interface and Testing:
Updated the format file to display the new history-related properties (
HistoryType,HistorySavePathText,HistorySavePathSQLite) in the output.Adjusted tests to use the new property names for history file paths. [1] [2] [3]
PR Context
This feature is discussed in issues: #3673 #1886
PR Checklist
Microsoft Reviewers: Open in CodeFlow