-
Notifications
You must be signed in to change notification settings - Fork 1
New TreeStoreDrive
TreeStore drives use LiteDb to store the data persistently. The database is opened None-exclusive to allow shared use between multiple powershell processes. Create a persistent drive based on a LiteDb database.
PS> New-TreeStoreDrive -Name tree -TreeStorePath "c:\tmp\data.db"Creating a TreeStore drive creates a function in your PowerShell environment ":" to make it comfortable to switch to the drive:
PS> gc Function:\tree:
Set-Location $MyInvocation.MyCommand.NameThe scope of visibility of the drive and the generated navigation functions is configurable. If the TresStore drive is created by another module for example the drive and the navigation function is visible to the modules code only. This can be changed by specifying the global scope:
PS> New-TreeStoreDrive -Name tree -TreeStorePath "c:\tmp\data.db" -Scope GlobalThese drives are useful for testing purposes. Their content isn't shared between PowerShell processes. They also use LiteDb internally but are based on a MemoryStream instead of a FileStream.
New-TreeStoreDrive -Name treeThe New-TreeStoreDrive cmdlet calls internally the PowerShell provider frameworks 'NewDrive' method. It is possible to create a TreeStore drive without its custom cmdlet:
New-PSDrive -Name tree -Root ..\jumps.db -PSProvider TreeStoreIf you use this method to create the drive a drive switching function ins't created.
Removing the drive with 'Remove-PSDrive' don't remove the drive switching function